golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/suggestedfix/issue65024.txt (about) 1 Regression example.com for #65024, "incorrect package qualification when 2 stubbing method in v2 module". 3 4 The second test (a-a) ensures that we don't use path-based heuristics 5 to guess the PkgName of an import. 6 7 -- a/v2/go.mod -- 8 module example.com/a/v2 9 go 1.18 10 11 -- a/v2/a.go -- 12 package a 13 14 type I interface { F() T } 15 16 type T struct {} 17 18 -- a/v2/b/b.go -- 19 package b 20 21 import "example.com/a/v2" 22 23 type B struct{} 24 25 var _ a.I = &B{} //@ suggestedfix("&B{}", re"does not implement", out) 26 27 // This line makes the diff tidier. 28 29 -- @out/a/v2/b/b.go -- 30 @@ -7 +7,5 @@ 31 +// F implements a.I. 32 +func (b *B) F() a.T { 33 + panic("unimplemented") 34 +} 35 + 36 @@ -10 +15 @@ 37 - 38 -- a-a/v2/go.mod -- 39 // This module has a hyphenated name--how posh. 40 // It won't do to use it as an identifier. 41 // The correct name is the one in the package decl, 42 // which in this case is not what the path heuristic would guess. 43 module example.com/a-a/v2 44 go 1.18 45 46 -- a-a/v2/a.go -- 47 package a 48 type I interface { F() T } 49 type T struct {} 50 51 -- a-a/v2/b/b.go -- 52 package b 53 54 // Note: no existing import of a. 55 56 type B struct{} 57 58 var _ I = &B{} //@ suggestedfix("&B{}", re"does not implement", out2) 59 60 // This line makes the diff tidier. 61 62 -- a-a/v2/b/import-a-I.go -- 63 package b 64 import "example.com/a-a/v2" 65 type I = a.I 66 67 -- @out2/a-a/v2/b/b.go -- 68 @@ -3 +3,2 @@ 69 +import a "example.com/a-a/v2" 70 + 71 @@ -7 +9,5 @@ 72 +// F implements a.I. 73 +func (b *B) F() a.T { 74 + panic("unimplemented") 75 +} 76 + 77 @@ -10 +17 @@ 78 -