Closed tulzke closed 1 year ago
Thanks for contribution @Tulzke, i'm happy to discuss here or in the ticket but I think the the exclusion list as a mockgen flag parameter is the best approach as (1) command line flags are current mechanism by which mock options are configured and (2) users won't be required to modify their source code to take advantage of the feature.
@r-hang , thanks for reply. Yes, I can do this via the flag parameter.
What naming should I do for this? Maybe -exclude
with comma separated interface names?
Example:
mockgen -exclude=Constraint,IgnoreMe -source=file.go -destination=file_mock.go
@Tulzke how about exclude_interfaces
in case there is something in the future that we'd want to exclude from generated code.
@r-hang, sounds good. I have already committed this.
@Tulzke the core logic looks could to me. However, could we add some tests for the newly added parseExcludeInterfaces function?
@r-hang good point. I added a unit test for the function, and then changed the implementation to satisfy the test cases.
The problem is described in the issue. This is one of the solutions to this problem.