Skip to content

Commit

Permalink
fix: use package path instead of name
Browse files Browse the repository at this point in the history
Co-authored-by: Fernandez Ludovic <[email protected]>
  • Loading branch information
lbenguigui and ldez authored Jul 7, 2022
1 parent 02e2cff commit ac75b95
Show file tree
Hide file tree
Showing 8 changed files with 5,926 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mocktail.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func walk(root, moduleName string) (map[string]PackageDesc, error) {

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

for _, imp := range getMethodImports(method, packageDesc.Pkg.Name()) {
for _, imp := range getMethodImports(method, packageDesc.Pkg.Path()) {
packageDesc.Imports[imp] = struct{}{}
}
}
Expand Down
5 changes: 5 additions & 0 deletions testdata/src/b/b.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package b

func Hello() string {
return "hello"
}
38 changes: 38 additions & 0 deletions testdata/src/b/c/foo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package c

import (
"bytes"
"context"
"time"

"golang.org/x/mod/module"
)

type Pineapple interface {
Hello(bar Water) string
World() string
Goo() (string, int, Water)
Coo(context.Context, string, Water) Water
}

type Coconut interface {
Boo(src *bytes.Buffer) time.Duration
Doo(src time.Duration) time.Duration
Foo(st Strawberry) string
Goo(st string) Strawberry
Hoo(string, int, Water)
Joo(string, int, Water) (string, int)
Koo(src string) (dst string)
Loo(st string, values ...int) string
Too(src string) time.Duration
Voo(src *module.Version) time.Duration
Yoo(st string) interface{}
Zoo(st interface{}) string
Moo(fn func(st, stban Strawberry) Pineapple) string
}

type Water struct{}

type Strawberry interface {
Bar(string) int
}
Loading

0 comments on commit ac75b95

Please sign in to comment.