Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Generate Method Stubs for Golang InterfacesNew to Visual Studio Code? Get it now.
Generate Method Stubs for Golang Interfaces

Generate Method Stubs for Golang Interfaces

Ricardo Erikson

|
14,781 installs
| (6) | Free
Automatically implement interface methods for Golang by using code generation
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Implement Method Stubs for Golang Interfaces - Visual Studio Code Extension

GitHub Workflow Status (branch) GitHub release (latest SemVer) semantic-release GitHub Version Installs

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.

Usage

Requirements

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:

  • Windows,
  • Linux,
  • and macOS

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.

Usage

  • 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!

Author

Ricardo Erikson

Comments

The extension is working, but there are a few things to improve. Any suggestions are welcomed. Please, feel free to contribute.

Enjoy!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft