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

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