Requested feature
I want to toggle whether to emit a comment of mock's origin (a .go file for source mode, a package and interface names for reflect mode) in a generated code like below (from example code):
Why the feature is needed
I made a wrapper tool of mockgen (named bulkmockgen), which manages interfaces to be mocked with a variable in a .go file and invokes mockgen with symbols arguments from the variable.
For example, running go generate with the below code will execute a command mockgen -package mock_foo -destination ./mock_foo/mock.go . IFoo,IBar.
This works fine, but there is a problem that the generated code's comment causes many Git conflicts because there are original interface names in one line in a top of generated code and the line is edited every time I add an interface name to mock target list.
(Optional) Proposed solution
Adding a command line flag like -write_source_comment and controlling whether to emit mock's origin comment by the flag will solve the problem described above.
I implemented it in my repository fork.
Requested feature I want to toggle whether to emit a comment of mock's origin (a
.go
file for source mode, a package and interface names for reflect mode) in a generated code like below (from example code):Why the feature is needed I made a wrapper tool of mockgen (named bulkmockgen), which manages interfaces to be mocked with a variable in a
.go
file and invokes mockgen with symbols arguments from the variable.For example, running
go generate
with the below code will execute a commandmockgen -package mock_foo -destination ./mock_foo/mock.go . IFoo,IBar
.This works fine, but there is a problem that the generated code's comment causes many Git conflicts because there are original interface names in one line in a top of generated code and the line is edited every time I add an interface name to mock target list.
(Optional) Proposed solution Adding a command line flag like
-write_source_comment
and controlling whether to emit mock's origin comment by the flag will solve the problem described above. I implemented it in my repository fork.