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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: "go bug" in build on different branch reports version different than "go version" #43981

Open
zikaeroh opened this issue Jan 29, 2021 · 1 comment

Comments

@zikaeroh
Copy link
Contributor

@zikaeroh zikaeroh commented Jan 29, 2021

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

(Note that the below is wrong; see the rest of the bug details. 馃檪)

$ go version
go version go1.15.7 linux/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jake/.cache/go-build"
GOENV="/home/jake/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/jake/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jake/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/jake/zikaeroh/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/jake/zikaeroh/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build237692121=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version devel +aca22bddf2 Wed Jan 27 21:57:05 2021 +0000 linux/amd64
GOROOT/bin/go tool compile -V: compile version devel +aca22bddf2 Wed Jan 27 21:57:05 2021 +0000
uname -sr: Linux 5.10.10-zen1-1-zen
/usr/lib/libc.so.6: GNU C Library (GNU libc) release release version 2.32.
gdb --version: GNU gdb (GDB) 10.1

What did you do?

I checked out dev.regabi, then did a ./make.bash. Then I ran go bug from my checkout's bin like ~/zikaeroh/go/bin/go bug.

What did you expect to see?

Open a browser with the commit from the branch, and the version filled in matches go version.

What did you see instead?

The version is of the wrong build (see the version at the top of this issue; which was generated with go bug). Running go version the same way as go bug reports:

go version devel +aca22bddf2 Wed Jan 27 21:57:05 2021 +0000 linux/amd64

Looking at the source for go bug, it seems to just run go version from $PATH, instead of reexecing itself or ensuring $GOROOT/bin is in $PATH (as does go env, apparently). I can see that GOROOT/bin/go version is printed as an environment variable, but it surprises me for the main version listed in the bug template to be of a different Go. (Maybe I'm the only one running a go binary directly and relying on implicit $GOROOT?)

@gopherbot
Copy link

@gopherbot gopherbot commented Feb 2, 2021

Change https://golang.org/cl/288693 mentions this issue: cmd/go: use implicit GOROOT for version and env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants