Closed JeremyLoy closed 6 years ago
Hitting this as well in another project as a result of picking up the new version of gomock, appears to be the same situation, not finding vendored code.
You're right: v1.0.1 should have been v1.1.0. Also, the regression is not intentional. I'll look into it right away. It would help if someone could show me a full test case.
I'm also a little confused by the error output. You're saying that mockgen runs successfully but then the output doesn't compile? Can you show me what the old and new imports in the mock look like? Also, what is the directory structure like?
@balshetzer Using the exact same checkout of our project code:
mockgen v1.0.1
fails and does not generate mocks when source files reference vendor
ed depsmockgen v1.0.0
works successfully.The directory structure is the standard project layout
OK, I've been able to replicate the issue. It looks like what's broken is mocking interfaces with vendored packages using "source mode" in mockgen. We only had a test for "reflect mode". I've added the test for source mode and will check it in as soon as I have a fix.
Thanks @balshetzer !
I've narrowed down the breaking change to: https://github.com/golang/mock/commit/bdab6673987ac44bb2e2d2ab121f7c6d46640bc4
@balshetzer that was incredibly fast, thank you for your work! Our builds are now succeeding with the new v1.1.0
.
The latest release of
v1.0.1
broke our CI builds. It seems that Mockgen no longer honors the vendor folder, and instead only looks in your GOROOT and GOPATH.Usage (
go generate
command at the top of a source file):file.go
importsbcrypt
Example error message (
bcrypt
exists in thevendor
folder):Rolling back to
v1.0.0
resolves the issue (using something like retool or manually checking out and building mockgen from source)Here is a diff of v1.0.0 to v1.0.1. It seems like a lot more was done than just a 'patch' according to semantic versioning as new features were added.
v1.0.1
should really bev1.1.0
.If no longer honoring the
vendor
folder is intentionalv1.0.0
should be markedv2.0.0
.