Description
We have set GO111MODULE=on by default in the Go 1.13 development branch, but we have reached the development freeze and there are still a number of important outstanding issues we have not had time to address, including making the transition for GOPATH users as smooth as possible in all the tools they use.
Based on discussion with @andybons, @ianthehat, @bcmills, @jayconrod, and others, I suggest we ship Go 1.13 with the GO111MODULE default set back to “auto”, but with the GOPATH/src restriction removed. Compared to Go 1.12 the definition of GO111MODULE=auto would change to:
“If GO111MODULE=auto or is unset, then the go command enables or disables module support based on the current directory. Module support is enabled only when the current directory is outside GOPATH/src and itself contains a go.mod file or is below a directory containing a go.mod file.”
That is, “is outside GOPATH/src” would be removed.
The effect would be that in Go 1.13, if you run go commands in a directory tree where someone has created a go.mod (that is, either you put the go.mod there, or the project you are contributing to has decided to switch to module-based development), then you get module mode, regardless of whether you happened to check it out inside or outside GOPATH/src. The “outside GOPATH/src” restriction has been the number one complaint about the existing automatic mode. Fixing it would help make the go command work better for all the people who are ready for modules, without turning it on for everyone prematurely.
Put another way, in Go 1.12 there were two steps to adopting modules for your project: (1) create a go.mod and (2) move your code. The new rule would cut out the difficult step (2) and leave the easy step (1). Module mode for module code, no matter where it is.
Thoughts?