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: reuses cached build affected by -ldflags and -X #18970

Closed
willfaught opened this issue Feb 7, 2017 · 3 comments
Closed

cmd/go: reuses cached build affected by -ldflags and -X #18970

willfaught opened this issue Feb 7, 2017 · 3 comments

Comments

@willfaught
Copy link
Contributor

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

go version go1.7.5 darwin/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/will.faught/Developer/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.7.5/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.7.5/libexec/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/jt/c0hjffqj6gxbhy00gm0btzkr79h225/T/go-build129389905=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

What did you do?

$ cd mymainpackage
$ go install -ldflags "-X github.com/foo/bar.Version=123"
$ mymainpackage --version # prints github.com/foo/bar.Version
123
$ go install -ldflags "-X github.com/foo/bar.Version=456" # 456 instead of 123
$ mymainpackage --version

What did you expect to see?

456

What did you see instead?

123
@davecheney
Copy link
Contributor

davecheney commented Feb 7, 2017 via email

@minux
Copy link
Member

minux commented Feb 7, 2017 via email

@rakyll
Copy link
Contributor

rakyll commented Feb 7, 2017

Duplicate of #18369.

@rakyll rakyll closed this as completed Feb 7, 2017
@golang golang locked and limited conversation to collaborators Feb 7, 2018
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

5 participants