golang / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
9.26k stars 608 forks source link

Add -package_format to customize the generated package name #632

Open dr-dime opened 2 years ago

dr-dime commented 2 years ago

Previously -package must be explicitly defined or it will default to mock_${name}. To generate a mock file that sits next to the package files, eg. as part of the test, one must extract the package name first. Which is not scripting-friendly.

After this change, we can use -package_format to customize the generated package name. So that a script can run mockgen without knowing the package name first.

Fixes #631

dr-dime commented 2 years ago

@codyoss friendly ping.

dr-dime commented 2 years ago

@codyoss friendly ping.

yuamera commented 2 years ago

I also have the same needs, I hope to use it as soon as possible, thank you!