-
Notifications
You must be signed in to change notification settings - Fork 610
mocking dependencies located in a vendor directory #4
Comments
Interesting. I haven't played with |
After a quick skim of |
Ah, yes, golang/go#12019 is certainly interesting and might be the cause of the breakage. |
@dsymonds yeah, in order for it to "just work" you also need to change mockgen to generate the temp program in the current directory. Then the call to |
I experienced something similar using Go 1.6 with vendored packages. From the error output, it looks like the vendored packages are being ignoring in the exec phase: $ mockgen -destination mocked.go github.com/vendored/package SomeInterface
prog.go:13:2: cannot find package "github.com/vendored/package" in any of:
/usr/local/go/src/github.com/vendored/package (from $GOROOT)
/home/ubuntu/.go_workspace/src/github.com/vendored/package (from $GOPATH) Basically, I didn't have time to debug the environment further, but I can provide a reproduction if this isn't enough information to track this down. If this is a different issue, please let me know and I'll file another. |
@stevvooe that is the same issue that I have experienced-- |
@rgarcia I just gave the fix a try and it works. Thanks for the PR. |
guys, can i help somehow with this ticket? |
@nizsheanez Help get #28 or a similar solution merged. I am about drop this package as it has been nothing but a headache. |
This issue has been open for about a year, if there's a PR and it works, why is it still open? Where are the maintainers? |
@sputnik13 I'd recommend steering clear of this package, if you can. I'd suggest people just do something similar to the technique described in #35 (comment). |
If you vendor a dependency into
vendor/
, what's the best way to generate mocks for it?If you use
mockgen
to generate mocks for that specific version of it, e.g.mockgen a/vendor/somedependency
, the generated mock has the wrong import:import somedependency "a/vendor/somedependency"
.The workaround I'm currently using is making sure the version in
$GOPATH/src/a/vendor/somedependency
matches the version in$GOPATH/src/somedependency
, and then runningmockgen somedependency
generates the correct code. This is cumbersome!The text was updated successfully, but these errors were encountered: