Modules outside GOPATH support
I try to use new Go 1.11 feature - modules outside GOPATH.
Code is built and ran correctly if I'm issuing commands via command line.
Dependencies are however not recognized in Goland.
I have enabled Go Modules integration, have correct GOROOT and GOPATH set up.
module bitbucket.org/tomeknst/friendbet/easyhttp
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/onsi/gomega v1.4.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sirupsen/logrus v1.0.6
github.com/stretchr/testify v1.2.2
golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b // indirect
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
)
It looks like above, any dependency that is not provided with standard Go installation is not resolved.
Is this feature already supported in Goland?
My setup is following:
go1.11 (linux/amd64)
Goland 2018.2.2 (build 182.4129.57)
Please sign in to leave a comment.
Hi,
Is go modules integration enabled for the project? Have you tried to press alt+enter on unresolved import?
Hi,
Thanks for reply.
I have go modules enabled (shown below)
After clearing go.sum and $GOPATH/pkg/mod, I was able to start syncing packages
After packages synced successfully I supposed the problem would have gone, but dependency was not resolved yet.
I tried once again with suggested command.
But when Go modules integration enabled it can't build from $GOPATH/src.
My project has multiple Go modules and only one VCS repository. Maybe it could be an issue?
Thanks,
Tomasz
Could you share the project sample to recreate this?
Yes, sure. I've granted you read access to repository on Bitbucket.
Currently it almost works, but is not recognizing other module packages in easyhttp module.
Problem looks now like in the below screenshot:
Packages within the same module "don't see" each other.
If I run go build ./... in easyhttp it works fine.
Ok, my fault. I used both IntelliJ and Goland for same project. After deleting modules and creating them again in IntelliJ with Go support it works great.