| 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"), loc(beforeX, re"()x"), loc(afterX, re"()x"), loc(beforeY, re"()Y"), loc(afterY, re"Y()") |
| 36 |
//@refs(beforeY, typeXY, anotherXY, GetXesY) |
| 37 |
//@refs(afterY, typeXY, anotherXY, GetXesY) |
| 38 |
//@refs(anotherXY, typeXY, anotherXY, GetXesY) |
| 39 |
|
| 40 |
//@refs(beforeX, defX, useX) |
| 41 |
//@refs(afterX, defX, useX) |
| 42 |
//@refs(useX, defX, useX) |
| 43 |
} |
| 44 |
} |