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
cmd/go: "go clean -i all" removes go binary #10710
Comments
go clean -i will remove the installed binary, this is documented.
cmd/go is included in "all" packages, so go clean -i all will remove the
installed go command.
This is working as intended.
|
I think this is consistent with the docs, introducing a special case
for the go command is going to break the consistency.
we obviously can't remove cmd/go from "all", and then the question
is why shouldn't go clean -i remove the installed binary of a package
or command included in the selected packages?
should go clean -i cmd/go be a no-op too? I doubt so.
|
The OP was unlucky enough to have installed go from source. If they were I don't think go clean should touch the std lib under any circumstance. On Wed, 6 May 2015 09:30 Minux Ma notifications@github.com wrote:
|
are you suggesting that go clean -i std cmd should be a no-op?
why are things in $GOROOT that different?
If we want to fix this, let's fix it in the correct way. Introduce
negative selectors so that one can use go clean -i all -std -cmd
to clean only GOPATHs.
|
On 6 May 2015 9:49 am, "Minux Ma" notifications@github.com wrote:
Because in the general case, users of the language, not you and me that
I disagree, this is an issue involving data loss; adding more flags and
|
go clean -i is a command that inherently involves data losses.
adding the GOROOT restriction it's like adding a safety measure to 'rm -rf
/*'.
|
Well, OP used homebrew on OS X, it's quite typical. |
Off topic, I have no idea why go clean is even necessary. On Wed, 6 May 2015 09:56 Minux Ma notifications@github.com wrote:
|
yeah, I have never used go clean -i myself.
I do use go clean in a directory though.
|
Just as "go build -a" does not rebuild the standard library in a release, I don't think that "go clean -i" should remove cmd/go in a release. There's just no way that anybody would expect that to happen. I'm also OK with dropping the -i option to go clean, I don't know who would use that. |
In this case (I'm original victim) I wanted to remove installed binaries from $GOPATH/bin. |
Why not just do rm $GOPATH/bin/* ? To me it seems wrong for the go tool to On Wed, May 6, 2015 at 10:33 AM, Alexey Palazhchenko <
|
I'm OK with dropping the -i option. I don't like more special case for GOROOT (I still believe the go install -a I agree with Dave that removing $GOPATH/bin/* is better to be explicit |
Two reasons:
|
go to the GOPATH and run go clean -i ./... there.
In retrospect, both go install -a all and go clean -i all problems are
because there isn't a selector for all of GOPATHs. If we don't like the
negative selector idea, we can introduce a selector for all packages
under GOPATHs.
|
The only downside is that command should be run at $GOPATH, not some $GOPATH subdirectory. |
I sent a CL (9780) for the "gopath" selector. Let's see what happens.
If it's accepted, then the solution for this problem is quite nice:
go clean -i gopath
And reinstalling GOPATH packages after upgrading Go is also simpler:
go install -a gopath
The only downside is that if there is a gopath package, then the meaning
of go install gopath is changed silently.
|
CL https://golang.org/cl/9780 mentions this issue. |
I tend to agree with Minux. The command says delete everything. It did. CL 9780 may end up with something useful, but it's not going to change what go clean -i all does. |
go clean -i all
command deletes go binary itself, and this behavior is undocumented.The text was updated successfully, but these errors were encountered: