Vs code go - auto generate missing method/func stubs

Hi all,

I am wondering if it is possible to auto-generate stubs of the missing methods/functions in VS code with any extension. I configured my vs code using the following:

I miss this feature in IntelliJ Idea (I was programming with Java before).

P.S. I know this is not a vs-code forum, but I thought it is a useful info for beginner go programmers as well (given the popularity of vs-code/go).

Thanks in advance.


with the installed extension you can autogenerate stubs to implement an interface.


Thanks for the response.

How can I actually do that? In the intellij idea, whenever the linter finds a missing method/func it was proposing a “Quick fix” and clicking it would generate the missing method stub. This is not working at least for me in VS code go extension as it is.

there’s an action Go: Generate Interface Stubs action.

For instance, if you have some code like

type MyType interface {
  Foo(num int) error
  Bar() (int, error)

type myStruct struct {
  a, b int

you can select the action and type s *myStruct MyType in the text input; the extension will generate the methods

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.