LEFT | RIGHT |
1 package describe // @describe pkgdecl "describe" | 1 package describe // @describe pkgdecl "describe" |
2 | 2 |
3 // @implements implements "^" | 3 // @implements implements "^" |
4 | 4 |
5 // Tests of 'describe' and 'implements' queries, -format=json. | 5 // Tests of 'describe' and 'implements' queries, -format=json. |
6 // See go.tools/oracle/oracle_test.go for explanation. | 6 // See go.tools/oracle/oracle_test.go for explanation. |
7 // See describe-json.golden for expected query results. | 7 // See describe-json.golden for expected query results. |
8 | 8 |
9 func main() { // | 9 func main() { // |
10 var s struct{ x [3]int } | 10 var s struct{ x [3]int } |
11 p := &s.x[0] // @describe desc-val-p "p" | 11 p := &s.x[0] // @describe desc-val-p "p" |
12 | 12 |
13 var i I = C(0) | 13 var i I = C(0) |
14 if i == nil { | 14 if i == nil { |
15 i = new(D) | 15 i = new(D) |
16 } | 16 } |
17 » _ = i //@describe desc-val-i "i" | 17 » _ = i // @describe desc-val-i "i" |
18 | 18 |
19 go main() // @describe desc-stmt "go" | 19 go main() // @describe desc-stmt "go" |
20 } | 20 } |
21 | 21 |
22 type I interface { | 22 type I interface { |
23 f() | 23 f() |
24 } | 24 } |
25 | 25 |
26 type C int // @describe desc-type-C "C" | 26 type C int // @describe desc-type-C "C" |
27 type D struct{} | 27 type D struct{} |
28 | 28 |
29 func (c C) f() {} | 29 func (c C) f() {} |
30 func (d *D) f() {} | 30 func (d *D) f() {} |
LEFT | RIGHT |