- Notifications
You must be signed in to change notification settings - Fork 18.5k
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/gocodeis the default path to your go workspace. If you want to change this path, set theGOPATHvariable 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.