]> Cypherpunks repositories - gostls13.git/commit
cmd/go: remove $GOROOT as a go get target
authorDave Cheney <dave@cheney.net>
Wed, 9 Jan 2013 22:57:01 +0000 (09:57 +1100)
committerDave Cheney <dave@cheney.net>
Wed, 9 Jan 2013 22:57:01 +0000 (09:57 +1100)
commit593d8b0c1409d044472a2848de199eec498100b1
tree86fdf5c8f3e8690d97d7a3a76b7cbb76aa3112d6
parent5ca4f5e48384fa9c483d1ed40364940e6cb4e355
cmd/go: remove $GOROOT as a go get target

Fixes #4186.

Back in the day, before the Go 1.0 release, $GOROOT was mandatory for building from source. Fast forward to now and $GOPATH is mandatory and $GOROOT is optional, and mainly used by those who use the binary distribution in uncommon places.

For example, most novices at least know about `sudo` as they would have used it to install the binary tarball into /usr/local. It is logical they would use the `sudo` hammer to `go get` other Go packages when faced with a permission error talking about the path they just had to use `sudo` on last time.

Even if they had read the documentation and set $GOPATH, go get will not work as expected as `sudo` masks most environment variables.

llucky(~) % ~/go/bin/go env | grep GOPATH
GOPATH="/home/dfc"
lucky(~) % sudo ~/go/bin/go env | grep GOPATH
GOPATH=""

This CL therefore proposes to remove support for using `go get` to download source into $GOROOT.

This CL also proposes an error when GOPATH=$GOROOT, as this is another place where new Go users can get stuck.

Further discussion: https://groups.google.com/d/topic/golang-nuts/VIg3fjHiHRI/discussion

R=rsc, adg, minux.ma
CC=golang-dev
https://golang.org/cl/6941058
doc/go1.1.html
src/cmd/go/doc.go
src/cmd/go/get.go
src/cmd/go/help.go