add interfaces flag with unit test#200
Conversation
59bd1d7 to
2553835
Compare
|
Hey @JacobOaks , can you please take a look? |
|
Hey @kliukovkin! Thanks for the PR! I am in favor of having this feature, just two questions/comments:
|
- Instead of using an -interfaces flag, what do you think about having source mode read positional arguments (i.e., mockgen -source <path/to/file.go> InterfaceOne,InterfaceTwo) to align it with how reflect mode works? (If there are no positional arguments specified, we would parse all interfaces to keep backwards compatibility) - Instead of parsing and then dropping interfaces that aren't specified, can we simply not parse ones that aren't requested? This is similar to how the exclusion flag already works and would avoid some wasted computation.
Hey @JacobOaks ! Done, can you please review and let me know if that looks good? |
|
@JacobOaks hey Jacob! Gentle ping here. |
…terInterfaces, update tests
abhinav
left a comment
There was a problem hiding this comment.
@sywhang This PR implements the changes you suggested in #281 (failing on missing expected interfaces).
@kliukovkin, thanks for updating. left some minor suggestions for improvements.
I see that the tests are failing, though.
Co-authored-by: Abhinav Gupta <mail@abhinavg.net>
|
Updated according to feedback.
Thanks for the review @abhinav ! 🚀 |
|
@kliukovkin thanks for updating the PR - could you please check the CI test run results and update the checked in golden files for tests? |
@sywhang ran |
This is a proposal for `-interfaces` flag using source mode. Using this flag it is possible to list only required interfaces to be mocked in source mode. Currently, source mode mocks all interfaces which -source file contains. Thanks @KastenMike for raising this! Fixes golang/mock#660 --------- Co-authored-by: Abhinav Gupta <mail@abhinavg.net>
This is a proposal for
-interfacesflag using source mode. Using this flag it is possible to list only required interfaces to be mocked in source mode. Currently, source mode mocks all interfaces which -source file contains.Thanks @KastenMike for raising this!
Fixes golang/mock#660