-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add feature to generate mocks in directory #193
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @horpto
Thanks for your contribution. I skimmed through your PR and some thoughts come to mind, that I would like to share with you.
General:
- For such an extension, it would have been beneficial to first create an issue, such that the topic can be discussed and multiple different approached could have been evaluated.
- Maybe the fix for the
version
should be in a separate PR, since this is pretty likely to be accepted and merged quickly, instead of combining this with a PR, where there is not yet any guarantee, that it will get accepted in due time.
Specific for the PR:
- The PR contains special handling for interface names, starting with
I
. To my knowledge, this is a pattern, that is not normally used in Go code (I would even go so far, that it is discouraged) and therefore I wonder, if a tool likemoq
should provide support for this. - For this PR to be merged, the README.md should be updated as well and reflect the changes to the flags and the arguments. Specifically it should mention, which flags are mutual exclusive.
@@ -30,6 +31,7 @@ type userFlags struct { | |||
func main() { | |||
var flags userFlags | |||
flag.StringVar(&flags.outFile, "out", "", "output file (default stdout)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the -out
flag mention as well, that it is exclusive with -out-dir
?
main.go
Outdated
if err = m.Mock(out, args...); err != nil { | ||
switch { | ||
case flags.outDir != "" && flags.outFile != "": | ||
return errors.New("use only one from -out and -out-dir arguments") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return errors.New("use only one from -out and -out-dir arguments") | |
return errors.New("use only one of the flags -out and -out-dir") |
Hi @breml! Ok, I created a new pr with only small changes. |
Hello, we use moq to generate mocks in the different directory in 1 mock to 1 file. So our genmock.go has a pile lines like this:
I'd like to add a feature to just specify directory and list of interfaces in one package. This also should be more quickly to generate mocks.
Also I fix version indication in release as gorelease will specify
main.version
, notmain.Version