matryer / moq

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

go:generate seems to ignore -pkg flag #30

Closed Jasrags closed 7 years ago

Jasrags commented 7 years ago

First off, thanks for the cool tool, it's a time saver. I have noticed that when generating mocks via go generate <pkg> and the file to be mocked having //go:generate moq -out ./mock/service_moq.go -pkg mock . Service

The generated file has the original package name of service and not mock as expected. When running moq -out ./mock/service_moq.go -pkg mock . Service from the service directory the generated file package is set to mock as expected.

Let me know if you need any further info from me.

matryer commented 7 years ago

Hmm weird, @Jasrags I wonder if you could submit a PR with a test that fails demonstrating this?

Jasrags commented 7 years ago

Strange, now that i run it again it works as expected.

matryer commented 7 years ago

hmmm... probably something slightly different the first time you did it.

matryer commented 7 years ago

Let me know if you see it again.

Jasrags commented 7 years ago

Thanks @matryer! Super interested in https://github.com/matryer/moq/issues/32 BTW. Thanks for the tool.

matryer commented 7 years ago

Fancy helping with it?

Jasrags commented 7 years ago

If i can, i have a fork already and spent a few minutes on it just now. I'll keep on looking.