golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/references/crosspackage.txt (about)

     1  Test of basic cross-package references.
     2  
     3  -- go.mod --
     4  module example.com
     5  go 1.12
     6  
     7  -- a/a.go --
     8  package a
     9  
    10  type X struct {
    11  	Y int //@loc(typeXY, "Y")
    12  }
    13  
    14  -- b/b.go --
    15  package b
    16  
    17  import "example.com/a"
    18  
    19  func GetXes() []a.X {
    20  	return []a.X{
    21  		{
    22  			Y: 1, //@loc(GetXesY, "Y"), refs("Y", typeXY, GetXesY, anotherXY)
    23  		},
    24  	}
    25  }
    26  
    27  -- c/c.go --
    28  package c
    29  
    30  import "example.com/b"
    31  
    32  func _() {
    33          xes := b.GetXes()
    34          for _, x := range xes { //@loc(defX, "x")
    35                  _ = x.Y //@loc(useX, "x"), loc(anotherXY, "Y"), refs("Y", typeXY, anotherXY, GetXesY), refs(".", defX, useX), refs("x", defX, useX)
    36          }
    37  }