rjeczalik / interfaces

Code generation tools for Go.
MIT License
420 stars 31 forks source link

Is it possible to include parameter names when generating an interface using `interfacer` #33

Open paprikati opened 2 years ago

paprikati commented 2 years ago

Is it possible to include parameter names when generating an interface using interfacer?

Currently, all the function parameter names are stripped so

 FooBar(ctx context.Context, eventContext string, includePrivate bool, includeGeo bool)

becomes

FooBar(ctx, string, bool, bool)

which is much harder to work with.

OscarVanL commented 2 years ago

I would prefer this too :)

rjeczalik commented 1 year ago

Overall this is good idea, I am not sure go/types gives you the name of the arguments in a typed func def. This needs to be researched.

OscarVanL commented 1 year ago

Overall this is good idea, I am not sure go/types gives you the name of the arguments in a typed func def. This needs to be researched.

Mockgen does this for generated mocks arg names, so maybe it's a good reference for how to achieve it?