josharian / impl

impl generates method stubs for implementing an interface.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make it easier to generate methods for package-local interfaces

NonLogicalDev opened this issue · comments

It would be nice to be able to implement interfaces from the same package you are editing.

Say I have interface Client with a bunch of methods, and I want a struct to implement that interface. Right now I would have to write out the whole path, and also will have to edit the package name out of the parameters.

Makes sense. My first reaction is to support adding a "-local" flag (name suggestions welcome) that elides the package name from the parameters.

As for the "writing out the whole path" bit, (a) the editor integrations could do that, or (b) the tool could support "./" as shorthand for the current package path when invoked from the command line (seems rarer).

Pull requests welcome.