Closed warmans closed 6 years ago
I can confirm I am also getting the same error on oid/gen.go
when used in packages which use the pq import as import _ "github.com/lib/pq"
.
Removing this import before generating the moq interface works and should not break things because it is a blank import name, but is annoying.
We have pq in our vendor directory as well, I will investigate if I have time. Until then some extra info: go 1.10beta2 os windows 10 latest moq
if anyone is blocked by this you can use my fork from here https://github.com/warmans/moq
I've been using it for a couple of weeks without any further issues.
Only thing is you need to check it out to the same directory as this repo since I didn't change any import paths. i.e. use GOPATH/src/github.com/matryer/moq
rather than GOPATH/src/github.com/warmans/moq
.
Thanks for the fork, I think this might be the solution. Good to hear that you have been using it for weeks without problems!
Fixed by https://github.com/matryer/moq/pull/45 I guess.
yep this should be fixed now.
This has been driving me crazy for about a day. Essentially it would appear that the presence of a vendor directory causes some kind of a problem related to checking the validity of packages. Here is some code to illustrate.
generate the mock
moq . Foo
OK all is good. Now run
dep ensure
and re-run the mockmoq . Foo
:That's weird. The pq project does indeed have a mix of packages in that directory but moq only cares about this if the package is vendored.
I've tried digging into the code but it's not at all clear what's causing this. Just disabling some vendor related code doesn't seem to help.
The error is returned here:
Extra information: moq version: latest master go version
go1.9.2
os: ubuntuExtra Mystery: A colleague on osx can still generate mocks on a larger project which fails for me on linux, but CAN re-produce the error with the example above.