-
Notifications
You must be signed in to change notification settings - Fork 609
Use dependencies in vendor/ instead of downloading them #296
Comments
The standard suggestion is to use A possible solution to this issue/bug would to make |
I got this working by putting in my go:generate line |
Thanks @Logibox. |
Value of -build_flags was passed to 'go' as a single argument. For example when passing -build_flags "-mod vendor", the invoked commandline was `go -mod\ vendor` and the go command errored out because there is no such arg. That has caused confusion, e.g. in golang#296 Solve this by splitting the argument by a space.
@Logibox I made a small fix #357 to address the -build_flags behavior. @amuttsch has the workaround with @soniah It would be great if you provided some more details about issues you are running into with |
Value of -build_flags was passed to 'go' as a single argument. For example when passing -build_flags "-mod vendor", the invoked commandline was `go -mod\ vendor` and the go command errored out because there is no such arg. That has caused confusion, e.g. in #296 Solve this by splitting the argument by a space.
Hi @nguyenfilip @codyoss I haven't looked at this for ages, I'll have to think through the issues and implications. @nguyenfilip I can't remember the issues I was having. I'm sure you've looked the HEAD of master; FYI mocks are now built into the @Logibox made the following comment earlier in the thread:
What results did you get from this @codyoss ? I feel your pain about self signed certs. Have you tried setting up a go mod proxy using Athens? |
@codyoss @amuttsch @soniah I think this has been fixed by #390 in mockgen 1.4.1. There was a similar problem described in another bug #347 and the OP in that bug confirmed the issue has been fixed for them. In the discussion of the bug I also provided some sample reproducer that shows correct behavior of mockgen+vendoring with mockgen 1.4.1 |
The problem is still there, I'm running mockgen:
|
@orian What version are you using? |
|
@orian Could you open up a new issue and detail a small example of how to reproduce. |
Hello |
@thynquest can you provide a small example showing this not working for you. This is a closed issue, so it is not being actively looked at. The original issue has been fixed. Please open a new issue with details to get better traction. |
I have a Go project that uses modules and stores its dependencies in the
vendor/
folder. In our CI pipeline, we installgomock
and run it via//go:generate mockgen -source ./foo/service.go -destination gen/foo/mocks.go -package foo
.gomock then tries to download all dependencies from its source repositories instead of using the vendor folder. This is problematic for us as we have some dependencies in a private repo that uses self signed certificates. Thats why we want to use the
vendor/
folder.We execute
go generate -mod vendor
to trigger the generation, we tried prefixing it withGOFLAGS=-mod=vendor
and using-build_flags "-mod vendor"
, but gomock always downloads all dependencies.How can we tell gomock to look for dependencies in the
vendor
folder first before downloading them? Thanks!The text was updated successfully, but these errors were encountered: