golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/rename/doclink.txt (about) 1 This test checks that doc links are also handled correctly (golang/go#64495). 2 3 -- go.mod -- 4 module example.com 5 6 go 1.21 7 8 -- a/a.go -- 9 package a 10 11 // Foo just for test [Foo] 12 // reference others objects [A] [B] [C] [C.F] [C.PF] 13 func Foo() {} //@rename("Foo", "Bar", FooToBar) 14 15 const A = 1 //@rename("A", "AA", AToAA) 16 17 var B = 1 //@rename("B", "BB", BToBB) 18 19 type C int //@rename("C", "CC", CToCC) 20 21 func (C) F() {} //@rename("F", "FF", FToFF) 22 23 func (*C) PF() {} //@rename("PF", "PFF", PFToPFF) 24 25 // D just for test [*D] 26 type D int //@rename("D", "DD", DToDD) 27 28 // E test generic type doc link [E] [E.Foo] 29 type E[T any] struct { //@rename("E", "EE", EToEE) 30 Field T 31 } 32 33 func (E[T]) Foo() {} //@rename("Foo", "Bar", EFooToEBar) 34 35 -- b/b.go -- 36 package b 37 38 import aa "example.com/a" //@rename("aa", "a", pkgRename) 39 40 // FooBar just for test [aa.Foo] [aa.A] [aa.B] [aa.C] [aa.C.F] [aa.C.PF] 41 // reference pointer type [*aa.D] 42 // reference generic type links [aa.E] [aa.E.Foo] 43 func FooBar() { 44 aa.Foo() 45 var e aa.E[int] 46 e.Foo() 47 } 48 49 50 -- @FooToBar/a/a.go -- 51 @@ -3 +3 @@ 52 -// Foo just for test [Foo] 53 +// Bar just for test [Bar] 54 @@ -5 +5 @@ 55 -func Foo() {} //@rename("Foo", "Bar", FooToBar) 56 +func Bar() {} //@rename("Foo", "Bar", FooToBar) 57 -- @FooToBar/b/b.go -- 58 @@ -5 +5 @@ 59 -// FooBar just for test [aa.Foo] [aa.A] [aa.B] [aa.C] [aa.C.F] [aa.C.PF] 60 +// FooBar just for test [aa.Bar] [aa.A] [aa.B] [aa.C] [aa.C.F] [aa.C.PF] 61 @@ -9 +9 @@ 62 - aa.Foo() 63 + aa.Bar() 64 -- @AToAA/a/a.go -- 65 @@ -4 +4 @@ 66 -// reference others objects [A] [B] [C] [C.F] [C.PF] 67 +// reference others objects [AA] [B] [C] [C.F] [C.PF] 68 @@ -7 +7 @@ 69 -const A = 1 //@rename("A", "AA", AToAA) 70 +const AA = 1 //@rename("A", "AA", AToAA) 71 -- @AToAA/b/b.go -- 72 @@ -5 +5 @@ 73 -// FooBar just for test [aa.Foo] [aa.A] [aa.B] [aa.C] [aa.C.F] [aa.C.PF] 74 +// FooBar just for test [aa.Foo] [aa.AA] [aa.B] [aa.C] [aa.C.F] [aa.C.PF] 75 -- @BToBB/a/a.go -- 76 @@ -4 +4 @@ 77 -// reference others objects [A] [B] [C] [C.F] [C.PF] 78 +// reference others objects [A] [BB] [C] [C.F] [C.PF] 79 @@ -9 +9 @@ 80 -var B = 1 //@rename("B", "BB", BToBB) 81 +var BB = 1 //@rename("B", "BB", BToBB) 82 -- @BToBB/b/b.go -- 83 @@ -5 +5 @@ 84 -// FooBar just for test [aa.Foo] [aa.A] [aa.B] [aa.C] [aa.C.F] [aa.C.PF] 85 +// FooBar just for test [aa.Foo] [aa.A] [aa.BB] [aa.C] [aa.C.F] [aa.C.PF] 86 -- @CToCC/a/a.go -- 87 @@ -4 +4 @@ 88 -// reference others objects [A] [B] [C] [C.F] [C.PF] 89 +// reference others objects [A] [B] [CC] [CC.F] [CC.PF] 90 @@ -11 +11 @@ 91 -type C int //@rename("C", "CC", CToCC) 92 +type CC int //@rename("C", "CC", CToCC) 93 @@ -13 +13 @@ 94 -func (C) F() {} //@rename("F", "FF", FToFF) 95 +func (CC) F() {} //@rename("F", "FF", FToFF) 96 @@ -15 +15 @@ 97 -func (*C) PF() {} //@rename("PF", "PFF", PFToPFF) 98 +func (*CC) PF() {} //@rename("PF", "PFF", PFToPFF) 99 -- @CToCC/b/b.go -- 100 @@ -5 +5 @@ 101 -// FooBar just for test [aa.Foo] [aa.A] [aa.B] [aa.C] [aa.C.F] [aa.C.PF] 102 +// FooBar just for test [aa.Foo] [aa.A] [aa.B] [aa.CC] [aa.CC.F] [aa.CC.PF] 103 -- @FToFF/a/a.go -- 104 @@ -4 +4 @@ 105 -// reference others objects [A] [B] [C] [C.F] [C.PF] 106 +// reference others objects [A] [B] [C] [C.FF] [C.PF] 107 @@ -13 +13 @@ 108 -func (C) F() {} //@rename("F", "FF", FToFF) 109 +func (C) FF() {} //@rename("F", "FF", FToFF) 110 -- @FToFF/b/b.go -- 111 @@ -5 +5 @@ 112 -// FooBar just for test [aa.Foo] [aa.A] [aa.B] [aa.C] [aa.C.F] [aa.C.PF] 113 +// FooBar just for test [aa.Foo] [aa.A] [aa.B] [aa.C] [aa.C.FF] [aa.C.PF] 114 -- @PFToPFF/a/a.go -- 115 @@ -4 +4 @@ 116 -// reference others objects [A] [B] [C] [C.F] [C.PF] 117 +// reference others objects [A] [B] [C] [C.F] [C.PFF] 118 @@ -15 +15 @@ 119 -func (*C) PF() {} //@rename("PF", "PFF", PFToPFF) 120 +func (*C) PFF() {} //@rename("PF", "PFF", PFToPFF) 121 -- @PFToPFF/b/b.go -- 122 @@ -5 +5 @@ 123 -// FooBar just for test [aa.Foo] [aa.A] [aa.B] [aa.C] [aa.C.F] [aa.C.PF] 124 +// FooBar just for test [aa.Foo] [aa.A] [aa.B] [aa.C] [aa.C.F] [aa.C.PFF] 125 -- @pkgRename/b/b.go -- 126 @@ -3 +3 @@ 127 -import aa "example.com/a" //@rename("aa", "a", pkgRename) 128 +import "example.com/a" //@rename("aa", "a", pkgRename) 129 @@ -5,3 +5,3 @@ 130 -// FooBar just for test [aa.Foo] [aa.A] [aa.B] [aa.C] [aa.C.F] [aa.C.PF] 131 -// reference pointer type [*aa.D] 132 -// reference generic type links [aa.E] [aa.E.Foo] 133 +// FooBar just for test [a.Foo] [a.A] [a.B] [a.C] [a.C.F] [a.C.PF] 134 +// reference pointer type [*a.D] 135 +// reference generic type links [a.E] [a.E.Foo] 136 @@ -9,2 +9,2 @@ 137 - aa.Foo() 138 - var e aa.E[int] 139 + a.Foo() 140 + var e a.E[int] 141 -- @DToDD/a/a.go -- 142 @@ -17,2 +17,2 @@ 143 -// D just for test [*D] 144 -type D int //@rename("D", "DD", DToDD) 145 +// DD just for test [*DD] 146 +type DD int //@rename("D", "DD", DToDD) 147 -- @DToDD/b/b.go -- 148 @@ -6 +6 @@ 149 -// reference pointer type [*aa.D] 150 +// reference pointer type [*aa.DD] 151 -- @EToEE/a/a.go -- 152 @@ -20,2 +20,2 @@ 153 -// E test generic type doc link [E] [E.Foo] 154 -type E[T any] struct { //@rename("E", "EE", EToEE) 155 +// EE test generic type doc link [EE] [EE.Foo] 156 +type EE[T any] struct { //@rename("E", "EE", EToEE) 157 @@ -25 +25 @@ 158 -func (E[T]) Foo() {} //@rename("Foo", "Bar", EFooToEBar) 159 +func (EE[T]) Foo() {} //@rename("Foo", "Bar", EFooToEBar) 160 -- @EToEE/b/b.go -- 161 @@ -7 +7 @@ 162 -// reference generic type links [aa.E] [aa.E.Foo] 163 +// reference generic type links [aa.EE] [aa.EE.Foo] 164 @@ -10 +10 @@ 165 - var e aa.E[int] 166 + var e aa.EE[int] 167 -- @EFooToEBar/a/a.go -- 168 @@ -20 +20 @@ 169 -// E test generic type doc link [E] [E.Foo] 170 +// E test generic type doc link [E] [E.Bar] 171 @@ -25 +25 @@ 172 -func (E[T]) Foo() {} //@rename("Foo", "Bar", EFooToEBar) 173 +func (E[T]) Bar() {} //@rename("Foo", "Bar", EFooToEBar) 174 -- @EFooToEBar/b/b.go -- 175 @@ -7 +7 @@ 176 -// reference generic type links [aa.E] [aa.E.Foo] 177 +// reference generic type links [aa.E] [aa.E.Bar] 178 @@ -11 +11 @@ 179 - e.Foo() 180 + e.Bar()