Skip to content

Commit ac75b95

Browse files
lbenguiguildez
andauthored
fix: use package path instead of name
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
1 parent 02e2cff commit ac75b95

File tree

8 files changed

+5926
-1
lines changed

8 files changed

+5926
-1
lines changed

mocktail.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func walk(root, moduleName string) (map[string]PackageDesc, error) {
148148

149149
interfaceDesc.Methods = append(interfaceDesc.Methods, method)
150150

151-
for _, imp := range getMethodImports(method, packageDesc.Pkg.Name()) {
151+
for _, imp := range getMethodImports(method, packageDesc.Pkg.Path()) {
152152
packageDesc.Imports[imp] = struct{}{}
153153
}
154154
}

testdata/src/b/b.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package b
2+
3+
func Hello() string {
4+
return "hello"
5+
}

testdata/src/b/c/foo.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package c
2+
3+
import (
4+
"bytes"
5+
"context"
6+
"time"
7+
8+
"golang.org/x/mod/module"
9+
)
10+
11+
type Pineapple interface {
12+
Hello(bar Water) string
13+
World() string
14+
Goo() (string, int, Water)
15+
Coo(context.Context, string, Water) Water
16+
}
17+
18+
type Coconut interface {
19+
Boo(src *bytes.Buffer) time.Duration
20+
Doo(src time.Duration) time.Duration
21+
Foo(st Strawberry) string
22+
Goo(st string) Strawberry
23+
Hoo(string, int, Water)
24+
Joo(string, int, Water) (string, int)
25+
Koo(src string) (dst string)
26+
Loo(st string, values ...int) string
27+
Too(src string) time.Duration
28+
Voo(src *module.Version) time.Duration
29+
Yoo(st string) interface{}
30+
Zoo(st interface{}) string
31+
Moo(fn func(st, stban Strawberry) Pineapple) string
32+
}
33+
34+
type Water struct{}
35+
36+
type Strawberry interface {
37+
Bar(string) int
38+
}

0 commit comments

Comments
 (0)