how to use Goland with module-aware go

With module aware go the GOPATH semantics are gone, replaced with a separate root source tree approach.

I was using Goland pointing at GOPATH and thus any 'go get' would add a package to my environment and index. Also any 'go install's would show an executable in GOPATH/bin within the same environment.

With module aware go, what is the intended user story for Goland? Have each module root as a  separate Goland environment?

3 comments

Hi Theodore,

Sorry, I didn't understand your question. What do you mean by GoLand environment and what is module aware go?

0
go 1.11 has a module-aware mode. When the env var GO111MODULE is set to on, 'go get' behavior becomes driven by go.mod file. This represents a very different way of working with source trees than the traditional GOPATH method of the go tools. 
 
So my question is, when I enable vgo with Goland, how should I now use Goland given that GOPATH is no longer the organizing principle of dependent packages and the behavior of the go tools.
0

> So my question is, when I enable vgo with Goland

Settings | Go | Go Modules

> This represents a very different way of working with source trees than the traditional GOPATH method of the go tools. 

You still need a GOPATH since Go Modules subsystem stores dependencies there. But it's not required for GoLand to index entire GOPATH sources. You can disable it in the `Settings | Go | GOPATH | Index entire GOPATH`.
 
> how should I now use Goland given that GOPATH is no longer the organizing principle of dependent packages and the behavior of the go tools.
 
No special rules as soon as Go Modules are enabled for a project. GoLand will invoke `go list` automatically to get and index all dependencies of your project.
 
0

Please sign in to leave a comment.