x/tools/gopls: code action to extracting an interface for usage #46665
Labels
FeatureRequest
gopls
Issues related to the Go language server, gopls.
Refactoring
Issues related to refactoring tools
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
Consider the following program:
Now assume we would like to test
foo
and for this we'd want to mockbar
. The recommended way of doing this is to extract the way thatbar
is used into an interface and use that in lieu ofbar
infoo
.Note that only
y()
was extracted.Supporting such a code action in gopls would make life a lot easier for devs who write unit tests.
This is at least viable to implement for unexported members, as no new methods can be added in other packages which access this member.
The text was updated successfully, but these errors were encountered: