Description
This proposal is a simplification of #12488.
In short, if the user has not set $GOPATH
in their environment the go
tool will default to a value of GOPATH=$HOME/gocode
.
Rationale
At the moment all the documentation we have says "you have to set a GOPATH", then people get distracted and upset because they don't understand why they have to do this.
By choosing a default GOPATH, we can make our documentation easier because we can say things like
$ go get github.com/foo/bar
will check out the github.com/foo/bar
repo into $HOME/gocode/src/github.com/foo/bar
.
We don't need to distract newcomers with having to set an env var, all we need to do is put a little parenthetical note at the bottom of the page
$HOME/gocode
is the default path to your go workspace. If you want to change this path, set theGOPATH
variable to something of your choosing.
Compatibility
This proposal only changes the experience for newcomers who have not chosen to set a $GOPATH
variable. For anyone using Go 1.1-1.7 today, your experience will be unchanged as you are currently required to set $GOPATH
.