Actual behavior
Generate mock for interface having embedded interface from another package leads to
Loading input failed: /Users/desotnikov/go/src/reproduceMockErr/package1/stub.go:6:13: failed parsing returns: /Users/.../go/src/reproduceMockErr/package1/stub.go:6:16: unknown package "model
Expected behavior
No error occured
To Reproduce
the following structure of project causes error
model/model.go
Actual behavior Generate mock for interface having embedded interface from another package leads to
Loading input failed: /Users/desotnikov/go/src/reproduceMockErr/package1/stub.go:6:13: failed parsing returns: /Users/.../go/src/reproduceMockErr/package1/stub.go:6:16: unknown package "model
Expected behavior No error occured
To Reproduce the following structure of project causes error model/model.go
package1/car.go
package1/stub.go
package2/sport.go
run:
mockgen -source package2/sport.go
Root cause as i mentioned in PR at ast library. It handles import deduplication in a wrong manner(not taking into account local aliasing).
Additional Information
Triage Notes for the Maintainers PR trying to fix that: https://github.com/golang/mock/pull/586