1
0

More than 1 year has passed since last update.

vscodeで[packages.Load error: err: exit status 2: stderr: go: no such tool "compile" go: no such tool "compile"]エラー発生したときの対処法

Posted at

詳細

vscodeでgo.modにて以下エラー発生

packages.Load error: err: exit status 2: stderr: go: no such tool "compile" go: no such tool "compile"

Screen Shot 2022-11-11 at 17.54.46.png

結論

vscodeのsetting.jsonのgopathが間違ってた

ローカルの$GOPATHが

$ echo $GOROOT
/usr/local/go

なのに、vscodeのsetting.jsonで指定されたpathが/usr/local/go/binなので事象発生してた

Screen Shot 2022-11-11 at 18.00.00.png

ローカルと同じGOPATHにしたら解決

Screen Shot 2022-11-11 at 18.02.06.png

原因

brewでインストールしたgoをアンインストールしたあと、公式サイトのパッケージのからインストールしたのでそれが原因
brewと公式サイトのパッケージではGOPATHが違うのにそれに合わせてvscodeのGOPATHを修正しないとエラー発生するという当たり前の話だった。
こうゆうのすごい単純なのに意外と気づかなくて沼ったので共有しました😂
ていうかそもそもsetting.jsonにGOPATHを設定する必要自体なさそう・・・。

1
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
1
0