Goland doesn't find installed packages

已完成

Hi,

after a recent hardware failure I had to reinstall GoLand (2022.1) and now all my projects won't compile because local and downloaded packages can't be found which worked fine before.

In one of the smaller projects I have one local import and one official package from gopkg.in and get this when trying to compile:

Example:

As you can see the local "logger" package and the official "yaml.v2" package can't be found.

 

My settings:

(Checking or unchecking "Index entire GOPATH" makes no difference)

All packages are present in the configured GOPATH:

The local package is also present:

 

I can compile my projects from the command line just fine.

评论操作 固定链接

Please collect the IDE logs, upload them to https://uploads.jetbrains.com/ and provide its ID. Do I get it right that you're using GOPATH instead of Go modules?

0
评论操作 固定链接

Hi,

I just uploaded the logs here: Upload id: 2022_05_09_8WeZGfAsrajuKmNm (file: goland-logs-20220509-10144615037747876037310308.zip)

Yes, I have set GO111MODULE = off. I already tried to switch this to 'on' and 'auto' but it makes no difference.

0
评论操作 固定链接

Thanks for the follow-up.

As far as I can see, you have to disable Go modules integration via File | Settings | Go | Go Modules.

Besides that, a project location doesn't correspond GOPATH approach. It should be inside $GOPATH/src (https://go.dev/doc/gopath_code).

Please keep in mind that GOPATH is deprecated and Go modules is actual way to manage dependencies (https://blog.jetbrains.com/go/2020/02/26/working-with-go-modules-getting-started/).

I hope it helps.

0
评论操作 固定链接

Hi,

thanks for your help. Looks like everythings works as before. :)

0

请先登录再写评论。