-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add flag to add go:generate directive in the generated file (#46)
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]>
- Loading branch information
1 parent
2417c65
commit 50aba74
Showing
3 changed files
with
78 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Package add_generate_directive makes sure output places the go:generate command as a directive in the generated code. | ||
package add_generate_directive | ||
|
||
type Message struct { | ||
Text string | ||
} | ||
|
||
type Foo interface { | ||
Bar(channels []string, message chan<- Message) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters