VS Code extension that automatically generates method stubs for Golang interfaces. Just inform the receiver and the interface. The extension will generate the method stubs.
First, you will need to have your Go environment correctly configured. The path folder for your Go binaries must also be added to the environment variable $PATH
in your operating system. Please, find below some guidelines on how to do that in your operating system:
Then, you will need to install the impl
package as follows:
go get -u github.com/josharian/impl
Obs: make sure your $GOPATH/bin
is in your $PATH
so that you can access the impl
binary.
- Inform the receiver as a comment (see some examples below):
// mt MyType
// mp *MyPointer
- Open the Command Palette
Ctrl+Shift+P
(Linux and Windows)Shift+Command+P
(macOS)
- Look for Go: Implement Interface Methods
- Start typing the name of the interface and pick it from the list (ex:
io.Reader
) - Hit Enter!
The extension is working, but there are a few things to improve. Any suggestions are welcomed. Please, feel free to contribute.
Enjoy!