Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1427)

Issue 6941058: code review 6941058: cmd/go: remove $GOROOT as a go get target (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 5 months ago by dave
Modified:
11 years, 4 months ago
Reviewers:
CC:
rsc, adg, minux1, golang-dev
Visibility:
Public.

Description

cmd/go: remove $GOROOT as a go get target Fixes issue 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

Patch Set 1 #

Patch Set 2 : diff -r 5a40587c014a https://code.google.com/p/go #

Total comments: 3

Patch Set 3 : diff -r 5a40587c014a https://code.google.com/p/go #

Total comments: 2

Patch Set 4 : diff -r 5a40587c014a https://code.google.com/p/go #

Patch Set 5 : code review 6941058: cmd/go: remove $GOROOT as a go get target #

Patch Set 6 : diff -r 87637f1ff532 https://code.google.com/p/go #

Total comments: 8

Patch Set 7 : diff -r 1481cdef28a6 https://code.google.com/p/go #

Patch Set 8 : diff -r 5acb449b2a67 https://code.google.com/p/go #

Total comments: 11

Patch Set 9 : diff -r d0d76b7fb219 https://code.google.com/p/go #

Patch Set 10 : diff -r d0d76b7fb219 https://go.googlecode.com/hg/ #

Patch Set 11 : diff -r d0d76b7fb219 https://go.googlecode.com/hg/ #

Patch Set 12 : diff -r d0d76b7fb219 https://go.googlecode.com/hg/ #

Patch Set 13 : diff -r c529f87b63d1 https://go.googlecode.com/hg/ #

Patch Set 14 : diff -r c529f87b63d1 https://go.googlecode.com/hg/ #

Patch Set 15 : diff -r 4254b351ee3c https://code.google.com/p/go #

Patch Set 16 : diff -r 4254b351ee3c https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -19 lines) Patch
M doc/go1.1.html View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +25 lines, -8 lines 0 comments Download
M src/cmd/go/doc.go View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M src/cmd/go/get.go View 1 2 5 10 11 12 13 14 1 chunk +10 lines, -9 lines 0 comments Download
M src/cmd/go/help.go View 1 2 5 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 31
Dustin
I agree with the change, but I think it should include a tl;dr to onramp ...
11 years, 5 months ago (2012-12-15 01:13:41 UTC) #1
kisielk
https://codereview.appspot.com/6941058/diff/2001/src/cmd/go/get.go File src/cmd/go/get.go (right): https://codereview.appspot.com/6941058/diff/2001/src/cmd/go/get.go#newcode256 src/cmd/go/get.go:256: return fmt.Errorf("cannot download, $GOPATH not set. For more details ...
11 years, 5 months ago (2012-12-15 01:14:25 UTC) #2
dave_cheney.net
> IMO, it'd be quite friendly to recommend someone set GOPATH to $HOME/go > if ...
11 years, 5 months ago (2012-12-15 01:15:12 UTC) #3
dave_cheney.net
Thank you for your comments. PTAL. For the moment, can we keep the discussion on ...
11 years, 5 months ago (2012-12-15 01:35:43 UTC) #4
minux1
I don't understand the GOPATH in this sentence quoted from the description. Back in the ...
11 years, 5 months ago (2012-12-15 13:21:29 UTC) #5
dave_cheney.net
Awww heck, it is so hard to keep these too straight. PTAL. On 16 Dec ...
11 years, 5 months ago (2012-12-15 13:22:44 UTC) #6
dave_cheney.net
Please take another look.
11 years, 5 months ago (2012-12-19 11:04:11 UTC) #7
dave_cheney.net
Hello dsallings@gmail.com, kamil.kisiel@gmail.com, minux.ma@gmail.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go
11 years, 5 months ago (2012-12-19 11:05:55 UTC) #8
bradfitz
LGTM https://codereview.appspot.com/6941058/diff/18001/src/cmd/go/test.bash File src/cmd/go/test.bash (right): https://codereview.appspot.com/6941058/diff/18001/src/cmd/go/test.bash#newcode187 src/cmd/go/test.bash:187: mkdir -p $d/src/pkg why src/pkg and not just ...
11 years, 5 months ago (2012-12-19 17:13:20 UTC) #9
minux1
I think you will need to document this change in doc/go1.1.html. https://codereview.appspot.com/6941058/diff/18001/src/cmd/go/doc.go File src/cmd/go/doc.go (right): ...
11 years, 5 months ago (2012-12-19 17:19:43 UTC) #10
dave_cheney.net
+ {rsc,adg} Thank you for your comments, PTAL. https://codereview.appspot.com/6941058/diff/18001/src/cmd/go/doc.go File src/cmd/go/doc.go (right): https://codereview.appspot.com/6941058/diff/18001/src/cmd/go/doc.go#newcode450 src/cmd/go/doc.go:450: GOPATH ...
11 years, 4 months ago (2012-12-20 01:05:05 UTC) #11
dave_cheney.net
Sorry, forgot the go1.1.html change, please hold off on reviews for the moment.
11 years, 4 months ago (2012-12-20 01:46:59 UTC) #12
dave_cheney.net
Hello dsallings@gmail.com, kamil.kisiel@gmail.com, minux.ma@gmail.com, bradfitz@golang.org, rsc@golang.org, adg@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 4 months ago (2012-12-20 05:26:01 UTC) #13
minux1
the gobuilder assumes the old 'go get' behavior, please fix the gobuilder and make sure ...
11 years, 4 months ago (2012-12-21 19:21:34 UTC) #14
adg
https://codereview.appspot.com/6941058/diff/24006/doc/go1.1.html File doc/go1.1.html (right): https://codereview.appspot.com/6941058/diff/24006/doc/go1.1.html#newcode65 doc/go1.1.html:65: <p>The <code>go</code> tool has acquired several improvements which are ...
11 years, 4 months ago (2013-01-02 03:37:24 UTC) #15
dave_cheney.net
Hi adg, Thank you for your comments. I will address them and address the issue ...
11 years, 4 months ago (2013-01-03 00:56:00 UTC) #16
adg
No objections. I'm pretty happy with this. On 3 Jan 2013 11:56, <dave@cheney.net> wrote: > ...
11 years, 4 months ago (2013-01-03 01:03:16 UTC) #17
dave_cheney.net
https://codereview.appspot.com/7034049/ addresses the changes required to the dashboard builder.
11 years, 4 months ago (2013-01-03 22:28:32 UTC) #18
dave_cheney.net
Done, thank you for your comments. https://codereview.appspot.com/6941058/diff/24006/doc/go1.1.html File doc/go1.1.html (right): https://codereview.appspot.com/6941058/diff/24006/doc/go1.1.html#newcode65 doc/go1.1.html:65: <p>The <code>go</code> tool ...
11 years, 4 months ago (2013-01-03 22:51:46 UTC) #19
dave_cheney.net
Hello dsallings@gmail.com, kamil.kisiel@gmail.com, minux.ma@gmail.com, bradfitz@golang.org, rsc@golang.org, adg@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 4 months ago (2013-01-03 22:54:52 UTC) #20
adg
LGTM But wait for rsc, too.
11 years, 4 months ago (2013-01-06 21:32:00 UTC) #21
dave_cheney.net
Of course. The next step is to work with the builder owners to get their ...
11 years, 4 months ago (2013-01-06 21:37:46 UTC) #22
dave_cheney.net
Hello rsc@golang.org, adg@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 4 months ago (2013-01-08 23:31:36 UTC) #23
dave_cheney.net
On 2013/01/08 23:31:36, dfc wrote: > Hello mailto:rsc@golang.org, mailto:adg@golang.org (cc: mailto:golang-dev@googlegroups.com), > > Please take ...
11 years, 4 months ago (2013-01-08 23:35:01 UTC) #24
rsc
I will leave the code review to adg. The new behavior is fine with me. ...
11 years, 4 months ago (2013-01-09 20:58:10 UTC) #25
minux1
On Thu, Jan 10, 2013 at 4:58 AM, <rsc@golang.org> wrote: > I will leave the ...
11 years, 4 months ago (2013-01-09 21:15:01 UTC) #26
rsc
>> I will leave the code review to adg. The new behavior is fine with ...
11 years, 4 months ago (2013-01-09 21:55:25 UTC) #27
adg
On 10 January 2013 08:55, Russ Cox <rsc@golang.org> wrote: > I am not sure where ...
11 years, 4 months ago (2013-01-09 22:05:09 UTC) #28
adg
LGTM
11 years, 4 months ago (2013-01-09 22:05:14 UTC) #29
dave_cheney.net
Thank you. Please accept my apologies for making the go tool a little less awesome. ...
11 years, 4 months ago (2013-01-09 22:08:26 UTC) #30
dave_cheney.net
11 years, 4 months ago (2013-01-09 22:57:23 UTC) #31
*** Submitted as https://code.google.com/p/go/source/detail?r=adf4e96e9aa4 ***

cmd/go: remove $GOROOT as a go get target

Fixes issue 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://codereview.appspot.com/6941058
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b