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

     1  package main // @referrers package-decl "main"
     2  
     3  // Tests of 'referrers' query.
     4  // See go.tools/guru/guru_test.go for explanation.
     5  // See referrers.golden for expected query results.
     6  
     7  import "lib"
     8  
     9  type s struct { // @referrers type " s "
    10  	f int
    11  }
    12  
    13  type T int
    14  
    15  func main() {
    16  	var v lib.Type = lib.Const // @referrers ref-package "lib"
    17  	_ = v.Method               // @referrers ref-method "Method"
    18  	_ = v.Method
    19  	v++ //@referrers ref-local "v"
    20  	v++
    21  
    22  	_ = s{}.f // @referrers ref-field "f"
    23  
    24  	var s2 s
    25  	s2.f = 1
    26  }
    27  
    28  var notexported int // @referrers unexported-from-test "notexported"
    29  
    30  // Test //line directives:
    31  
    32  type U int // @referrers ref-type-U "U"
    33  
    34  //line nosuchfile.y:123
    35  var u1 U
    36  var u2 U