matryer / moq

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

Allow specifying name for generated mock #67

Closed sudo-suhas closed 5 years ago

sudo-suhas commented 6 years ago

Right now, the name for the generated mock is {{.InterfaceName}}Mock and it works well for most cases. However, I wanted to keep all the generated mocks in a separate mock pkg as suggested by Ben Johnson - https://medium.com/@benbjohnson/standard-package-layout-7cdbc8391fc1#f68c. The problem was that I had multiple interfaces with the same name in different packages(a.APIClient, b.APIClient, c.APIClient ...). So what I wanted was to have the mocks of the form mock.AClient, mock.BClient etc. I forked the repo and made minimal changes to make this possible - sudo-suhas/moqit. Do you think this is a feature worth having?