Automatically generate code for new interface methods in all existing implementations?

I sometimes find that I need to add a new method to an interface that has many implementations. Is there some quick way to automatically generate skeleton code (e.g. of the Generate -> Implement Methods) sort when I do this for every type that was an implementation before the new method was added?

Activating the Generate -> Implement Methods shortcut is smart enough to know to just add the single new method (as opposed to all methods) when instructed, but this requires doing so for each and every implementation of the interface. This becomes tricky, because having added a new method means that the IDE no longer considers the implementations to actually implement the interface (because they don't yet have the code for the new method).

So we either

a) Manually add the code to each interface; not taking advantage of the boilerplate code generation capabilities of the IDE, and then add the method to the interface or;

b) Add the method to the interface and use the automatic boilerplate code generation, but manually track which types previously implemented the interface.

Neither of these approaches are ideal, and it seems likely an extremely common situation during development. Is there some shortcut or capability that I am missing?

2 comments
Comment actions Permalink
Official comment

Hi,

There is a feature request for it: https://youtrack.jetbrains.com/issue/GO-6262. Please vote for the issue to get updates

Please sign in to leave a comment.