golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/rename/crosspkg.txt (about) 1 This test checks cross-package renaming. 2 3 -- go.mod -- 4 module golang.org/lsptests/rename 5 6 go 1.18 7 8 -- crosspkg/crosspkg.go -- 9 package crosspkg 10 11 func Foo() { //@rename("Foo", "Dolphin", FooToDolphin) 12 13 } 14 15 var Bar int //@rename("Bar", "Tomato", BarToTomato) 16 17 -- crosspkg/another/another.go -- 18 package another 19 20 type ( 21 I interface{ F() } 22 C struct{ I } 23 ) 24 25 func (C) g() 26 27 func _() { 28 var x I = C{} 29 x.F() //@rename("F", "G", FToG) 30 } 31 32 -- crosspkg/other/other.go -- 33 package other 34 35 import "golang.org/lsptests/rename/crosspkg" 36 37 func Other() { 38 crosspkg.Bar //@diag("crosspkg", re"not used") 39 crosspkg.Foo() //@rename("Foo", "Flamingo", FooToFlamingo) 40 } 41 42 -- @BarToTomato/crosspkg/crosspkg.go -- 43 @@ -7 +7 @@ 44 -var Bar int //@rename("Bar", "Tomato", BarToTomato) 45 +var Tomato int //@rename("Bar", "Tomato", BarToTomato) 46 -- @BarToTomato/crosspkg/other/other.go -- 47 @@ -6 +6 @@ 48 - crosspkg.Bar //@diag("crosspkg", re"not used") 49 + crosspkg.Tomato //@diag("crosspkg", re"not used") 50 -- @FToG/crosspkg/another/another.go -- 51 @@ -4 +4 @@ 52 - I interface{ F() } 53 + I interface{ G() } 54 @@ -12 +12 @@ 55 - x.F() //@rename("F", "G", FToG) 56 + x.G() //@rename("F", "G", FToG) 57 -- @FooToDolphin/crosspkg/crosspkg.go -- 58 @@ -3 +3 @@ 59 -func Foo() { //@rename("Foo", "Dolphin", FooToDolphin) 60 +func Dolphin() { //@rename("Foo", "Dolphin", FooToDolphin) 61 -- @FooToDolphin/crosspkg/other/other.go -- 62 @@ -7 +7 @@ 63 - crosspkg.Foo() //@rename("Foo", "Flamingo", FooToFlamingo) 64 + crosspkg.Dolphin() //@rename("Foo", "Flamingo", FooToFlamingo) 65 -- @FooToFlamingo/crosspkg/crosspkg.go -- 66 @@ -3 +3 @@ 67 -func Foo() { //@rename("Foo", "Dolphin", FooToDolphin) 68 +func Flamingo() { //@rename("Foo", "Dolphin", FooToDolphin) 69 -- @FooToFlamingo/crosspkg/other/other.go -- 70 @@ -7 +7 @@ 71 - crosspkg.Foo() //@rename("Foo", "Flamingo", FooToFlamingo) 72 + crosspkg.Flamingo() //@rename("Foo", "Flamingo", FooToFlamingo)