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

cmd/go: `go get` removes installed binary if current working directory is $GOPATH/bin #32766

Closed
fhs opened this issue Jun 25, 2019 · 2 comments
Closed
Assignees
Milestone

Comments

@fhs
Copy link
Contributor

@fhs fhs commented Jun 25, 2019

What version of Go are you using (go version)?

$ go version
go version devel +df901bce5e Tue Jun 25 01:48:46 2019 +0000 linux/amd64

Does this issue reproduce with the latest release?

No (tested using go1.12.6)

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/fhs/.cache/go-build"
GOENV="/home/fhs/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/fhs/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/big/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/big/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build151242700=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ echo $GOBIN

$ echo $GOPATH
/home/fhs/go
$ cd $GOPATH/bin
$ ls -l $GOPATH/bin/stringer
-rwxr-xr-x 1 fhs fhs 6850911 Jun 25 03:25 /home/fhs/go/bin/stringer
$ go get golang.org/x/tools/cmd/stringer
go: finding golang.org/x/tools/cmd/stringer latest
go: finding golang.org/x/tools latest
$

What did you expect to see?

$ ls -l $GOPATH/bin/stringer
-rwxr-xr-x 1 fhs fhs 6850911 Jun 25 03:32 /home/fhs/go/bin/stringer

What did you see instead?

$ ls -l $GOPATH/bin/stringer
ls: cannot access '/home/fhs/go/bin/stringer': No such file or directory
@FiloSottile

This comment has been minimized.

Copy link
Member

@FiloSottile FiloSottile commented Jun 25, 2019

@jayconrod jayconrod self-assigned this Jun 25, 2019
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jun 25, 2019

Change https://golang.org/cl/183846 mentions this issue: cmd/go: 'go get' should not delete binaries when run from $GOBIN

@gopherbot gopherbot closed this in 24f7d89 Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.