LoginSignup
1

More than 3 years have passed since last update.

go moduleを導入した時にinttelijで設定する事

Posted at

背景

gomoduleを入れてからintellijで「モジュールが見つかりません」的なエラーが出るようになった。
go getをしても下記のようなエラーが出る。

$ go get github.com/xxxxd/xxxxxd
go get: warning: modules disabled by GO111MODULE=auto in GOPATH/src;
        ignoring go.mod;
        see 'go help modules'

どうすれば良いか

go moduleでインストールされたパッケージは$GOPATH/pkg/に置かれるらしい。

なのでパッケージを読み込んでいる場所を変えてあげる必要がある。

preferences > 言語 & フレームワーク > Go > Go module(vgo)
で下記のチェックボックスを入れるとちゃんと読み込んでくれる様になりました。

image.png

参考

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