Closed si-m closed 5 years ago
You should use the -destination
argument, instead of redirecting the output, then generating works fine:
$GOPATH/bin/mockgen -package example -source=example/example.go \
-mock_names Foo=MockFoo,Bar=MockBar -destination=example/example_mocks.go
Okay the -destination
flag fixes my problem, but it was working fine a few days ago. It would be nice to have versions.
We do use versions. We haven't yet released a new version. You must be following head.
On Thu, Mar 14, 2019, 12:51 PM Santiago notifications@github.com wrote:
Okay the -destination flag fixes my problem, but it was working fine a few days ago. It would be nice to have versions.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/golang/mock/issues/274#issuecomment-472959939, or mute the thread https://github.com/notifications/unsubscribe-auth/ABwtxlBaQfiSgXN0tdYnhvTgUAbnW6gvks5vWn4hgaJpZM4bs7JO .
This started happening yesterday in the CI which installs a fresh version of
mockgen
. Then I rango get -u github.com/golang/mock/mockgen
and i could reproduced it locally.The issue is that if i have two interfaces and one has a method that returns the other one, the generated mock file imports its own package, I doesn't realize that its in that same package.
The issue happens in source mode and reflect mode.
How to reproduce the issue
example package
Create mocks for this package: