New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make source mode command line arguments consistent with reflect mode #136

sam701 opened this Issue Dec 16, 2017 · 0 comments


None yet
1 participant

sam701 commented Dec 16, 2017

Here is the basic usage of the reflect mode

mockgen database/sql/driver Conn,Driver

It would be helpful to make the source mode usage to be like this:

mockgen -source-dir myPackageDir privateInterface1,privateInterface2,PublicInterface3

This approach has a few benefits:

  1. All generated mocks of a package will reside in a single file. Currently if you need to mock just a couple of interfaces, you might run mockgen for every single file in the package. This leads to many unneeded files. Some of them don't contain any mocks. Additionally you cannot do it in a single mockgen call but have to loop in a script file.
  2. It makes straightforward to mock specific private interfaces. Currently all interfaces from the source file will be mocked, even if some of them are not required to be mocked.
  3. Last but not least, it is consistent with the reflect mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment