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.


require ( v1.1.1 // indirect v1.4.2 // indirect v1.0.0 // indirect v1.0.6 v1.2.2 v0.0.0-20180910181607-0e37d006457b // indirect v2.0.9 // indirect 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)


Is go modules integration enabled for the project? Have you tried to press alt+enter on unresolved import?



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?



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.


Please sign in to leave a comment.