Closed mirogta closed 4 years ago
You have to specify destination before package and Interface. Example: mockgen -destination=path/to/mock/foo_mock.go example.com/foo Bar
Thanks for clarification. I can confirm that if I put the -destination
parameter first then it works OK.
Would it make sense to clarify this in the error message and documentation perhaps? Maybe the "Expected exactly two arguments." is a bit misleading? It didn't help in my case and led me to a wrong conclusion, because I actually needed to pass three arguments.
Maybe it's just me, but I call every parameter passed to a command an argument, I don't make difference between flags (i.e. -destination
) and arguments ('example.com/foo' and 'Bar').
Yeah, it is a bit confusing you are right. We have some issue to get some better docs and samples out in the future. Let me know if you have more questions in the future.
Requested feature
The source mode supports the
-destination
parameter.This parameter is not flagged in the documentation as
(source mode)
only, so it looks like it's possible to use it for the reflect as well. However it does not work. When I add the-destination
parameter for the reflect mode then it fails with an error: "Expected exactly two arguments"Why the feature is needed
Maybe it's a bug, because the documentation suggests the
-destination
parameter would work for the reflect mode as well as for the source mode? Anyway I don't see a reason why the reflect mode would always output the code to stdout, when there is already an existing parameter to output it to a file.