matryer / moq

Interface mocking tool for go generate
http://bit.ly/meetmoq
MIT License
2k stars 127 forks source link

packages not found error #95

Closed pdrum closed 5 years ago

pdrum commented 5 years ago

I am getting this error when running moq on Mac with Go 1.11.6 (moq . Hi for example):

Couldn't load source package: packages not found

Any idea why it is happening and how to fix it?

BTW this did not happen a while ago. some new release might have caused it if it's not sth I have done wrong in my own code.

pdrum commented 5 years ago

image

pdrum commented 5 years ago

I also ran tests of moq itself and they fail with following messages There might be sth wrong with my environment but I can't figure out what image

pdrum commented 5 years ago

After hours of searching I came across this issue https://github.com/google/wire/issues/125 in wire repo. It seems I had updated my go installation to 1.12 (then 1.11 to see if it helps) but my golang.org/x/tools was leftover from go 1.9.6 and golang.org/x/tools/go/packages which was left from previous installation was the reason for these errors.

In order to fix it, I removed both go tools and moq, then reinstalled both and everything worked.