Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: document installation of godoc, cover, vet for source installs #5663

Closed
minux opened this issue Jun 7, 2013 · 8 comments
Closed

doc: document installation of godoc, cover, vet for source installs #5663

minux opened this issue Jun 7, 2013 · 8 comments

Comments

@minux
Copy link
Member

minux commented Jun 7, 2013

see discussion in https://golang.org/cl/10110043/.
@rsc
Copy link
Contributor

rsc commented Sep 10, 2013

Comment 1:

Labels changed: added documentation.

@minux
Copy link
Member Author

minux commented Sep 23, 2013

Comment 3:

a big problem is that: users of binary distributions might need root privilege to update
godoc and vet.

@adg
Copy link
Contributor

adg commented Sep 23, 2013

Comment 4:

They would have needed such privileges in the first place.
My concern is this:
$ cd /usr/local
$ sudo tar xzf go.tar.gz
$ export GOPATH=$HOME
$ sudo go get code.google.com/p/go.tools/cmd/{cover,godoc,vet}
This installs the tools to /usr/local/bin, but now $GOPATH/{src,pkg} contain a bunch of
source and object files that are owned by root. :-/
We could potentially fix this by forcing it to be a two part process. Where "go get"
detects refuses to download source and write package objects as the superuser. For
instance:
$ sudo go get code.google.com/p/go.tools/cmd/{cover,godoc,vet}
Cannot "go get" as root.
So then the user would try:
$ go get code.google.com/p/go.tools/cmd/{cover,godoc,vet}
Can't write to /usr/local/go/bin.
$ sudo go get code.google.com/p/go.tools/cmd/{cover,godoc,vet}
Success, because all this does is build the binaries and cp them to /usr/local/go/bin.
The source has been fetched and the dependent packages have been compiled by the
previous invocation. 
Maybe there's a bigger picture here involving the standard library and the -a flag, too.
The main question is: do we want to make the go tool behave differently when executed by
a superuser?

@minux
Copy link
Member Author

minux commented Sep 23, 2013

Comment 5:

yeah, that is my concern too.
i wonder if we could just support installing godoc and vet to GOPATh/bin?
the one in the default location could look for those in GOPATH,
and exec them if found.

@rsc
Copy link
Contributor

rsc commented Sep 23, 2013

Comment 6:

No, we definitely do not want the go command to behave differently when executed by
root. Don't second guess what people ask it to do.
The shell transcript you gave is no different than running make && make install as root
in a non-Go program's installation. You end up with files owned by root. So don't do
that. 
If the user tries
$ cd /usr/local
$ sudo tar xzf go.tar.gz
$ export GOPATH=$HOME
$ sudo go get code.google.com/p/go.tools/cmd/{cover,godoc,vet}
then I think they deserve what they get. We can't help people who don't understand how
to be root. Why are they updating just those three programs? Why are those different
from gofmt? I really don't understand the problem being solved here.
I thought this bug was about telling people who build from source how to get those
programs, since they otherwise would not. 
And in that case I think the answer is you run the 'go get -u
code.google.com/p/go.tools/cmd/cover' and then again for godoc and vet (cannot use { }
syntax because it doesn't work in all shells, notably Windows).

@adg
Copy link
Contributor

adg commented Sep 23, 2013

Comment 7:

I suppose it is reasonable to assume that people who install from source should
understand how root works, and that people who install with binary distributions need
not update godoc, vet, or cover until they install the next binary release.
We should, however, document the installation of godoc, cover, and vet in the source
installation instructions.

@adg
Copy link
Contributor

adg commented Sep 24, 2013

Comment 8:

Owner changed to @adg.

@adg
Copy link
Contributor

adg commented Sep 25, 2013

Comment 9:

This issue was closed by revision b3caa86.

Status changed to Fixed.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned adg Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants