-
Notifications
You must be signed in to change notification settings - Fork 28
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
Params is a keyword? #111
Comments
Hey @flyinprogrammer, thanks for reporting this and of course for the magnificent sloth there :-). I think we should definitely make the code generator smarter here. Seems like the simplest would be to prefix or suffix the local variable names with I'd be very happy to merge that PR, if you decide to contribute. Thank you, |
Context:
So I've stumbled upon needing to use this project while trying to resurrect the wildly out of date / broken slack client in Atlantis: https://github.com/runatlantis/atlantis/tree/master/server/events/webhooks
I'm not sure how much anyone cares about any of these rambles, but this community seems like they might care? So here we are.
So the first discovery I've found is trivial, defining an interface's method with a parameter named
params
makes our generator create broken code:https://github.com/flyinprogrammer/pegomock_examples/blob/issues/params_keyword/slack.go#L8
https://github.com/flyinprogrammer/pegomock_examples/blob/issues/params_keyword/mocks/mock_slack_client.go#L32
The solution is to simply ignore the provided name
params
:https://github.com/slack-go/slack/blob/master/conversation.go#L81
And do something like this:
https://github.com/flyinprogrammer/pegomock_examples/blob/workaround/params_keyword/slack.go#L8
https://github.com/flyinprogrammer/pegomock_examples/blob/workaround/params_keyword/mocks/mock_slack_client.go#L32
And we're off again.
Not sure if we want to document this hiccup, or make our code generator smarter? Happy to contribute, just need some guidance.
The text was updated successfully, but these errors were encountered: