-
Notifications
You must be signed in to change notification settings - Fork 117
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
Add flag to generate go:generate instruction in the generate file #45
Comments
Hey @damianopetrungaro this is interesting. Wouldn't the human have to first generate the mock in order to get this //go:generate mockgen -destination=./mocks/Doer.go -package=mocks path/to/pkg Doer
type Doer interface {
Do() error
} Would that sort of approach be helpful to you and alleviate the human errors aspect? Or is there an additional benefit to the proposed approach that I'm missing? So far, this approach is working nicely for my team, but I'm always up for improving! |
@bradleygore I guess there's more than one way to skin a cat. What I find useful is more the other way around, |
As you can read by the PR title, I added a flag (false by default) that allows mockgen to add the go:generate instruction as part of the generated file. This is something I was looking to see supported, and I finally had some time to add this tiny feature. It would save a lot of time, and it is similar to what other tools already ([gowrap](https://github.com/hexdigest/gowrap) for example). Resolves: #45 --------- Co-authored-by: Moises Vega <[email protected]> Co-authored-by: Sung Yoon Whang <[email protected]>
Requested feature: Add support for a "go:generate" instruction as part of the generated mock files in gomock.
Why the feature is needed: Currently, when using gomock to generate mock files, there is no built-in functionality to include a "go:generate" instruction within the generated mock files.
This instruction is essential for integrating the generated mocks seamlessly into the development workflow; there are already other popular go libraries that do that (for example:
hexdigest/gowrap
).Without this feature, users are required to manually add the "go:generate" instruction to each generated mock file, which is time-consuming and prone to human errors, and overall hard to maintain.
(Optional) Proposed solution:
https://github.com/damianopetrungaro/mock/tree/feat_add_go_generate_instruction
The text was updated successfully, but these errors were encountered: