github.com/april1989/origin-go-tools@v0.0.32/cmd/guru/testdata/src/describe-json/main.go (about)

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