Skip to content

Params is a keyword? #111

@flyinprogrammer

Description

@flyinprogrammer

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.

sloth_smile

Not sure if we want to document this hiccup, or make our code generator smarter? Happy to contribute, just need some guidance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions