0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VScodeのGo: Generate Interface Stubsでエラーが出る場合の対処法メモ

Posted at

事象

同一ファイルでstructとinterfaceを定義して、structに対してinterfaceのメソッドを実装するために、Go Generete Interface Stubsしたところエラーになる。

コマンドパレットからGo Generate Interface Stubsを実行。

image.png

image.png

この時、VSCodeでエラーが出てしまう

Cannot stub interface: unrecognized interface go generate interface

対処法

自分の環境ではこれで直った。

go get -u github.com/josharian/impl

インストール後、再度Go Generate Interface Stubsを試す。

image.png

今度はstructにインタフェースのメソッドが追加された。

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?