Closed berndwarmuth closed 6 years ago
I have been banging my head against this one for hours. I saw your issue and I realised exactly what the issue is, so thanks!
Maybe it's the same for you, I use dep to get my dependencies and it wants to install the v1.0.0
tag of github.com/golang/mock
while go getting to install the mockgen
binary will give you the master branch. I think its the two differing versions which is causing the problem. I changed Gopkg.toml
to install master
not the tagged release, and it works.
I hope this helps you as much as it has helped me!!
Thank you adam, this fixed the problem for me as well :-)
for posterity, an alternative way to solve this is to tell dep to force the missing imports in it's SAT solver.
I added the following to Gopkg.toml
:
# NB: need the following to ensure we pull down mockgen despite not calling the code
# directly in the repo. mockgen (the tool) requires the source to be present or its :(
required = ["github.com/golang/mock/mockgen"]
This lets you specify whatever version/revision of mock you want to be on, which you might prefer over branch = "master"
.
I am using
mockgen
to generate mocks for my interfaces. It all works fine, however as soon as i include the sources forgomock
into the vendor directory using golang/dep, themockgen
command fails with the following error message:Loading input failed: gob: name not registered for interface: "github.com/triggetry/goproj/vendor/github.com/golang/mock/mockgen/model.PredeclaredType"
Any ideas? Thanks