You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The previous documentation example mentioned GOFLAGS='-ldflags=-w -ldflags=-s', which does something completely different. The second per-package flag overrides the first, so the linker ends up being called with just -s and not -w -s.
There should be a way to do go build -ldflags='-w -s' via GOFLAGS. This can either be done by tweaking GOFLAGS, or by tweaking per-package flags - I personally don't mind, as long as there's a way to achieve it.
This partially reverts https://golang.org/cl/135035.
Reason for revert: multiple -ldflags=-foo flags simply override each
other, since that's the logic for per-package flags. The suggested
'GOFLAGS=-ldflags=-s -ldflags=-w' has never worked for 'go build', and
even breaks 'go test' and 'go vet'.
There should be a way to specify -ldflags='-w -s' via GOFLAGS, which is
being tracked in #29096. For now, just remove the incorrect suggestion.
Fixes#29053.
Change-Id: I9203056f7e5191e894bcd16595a92df2fb704ea7
Reviewed-on: https://go-review.googlesource.com/c/152479
Reviewed-by: Bryan C. Mills <[email protected]>
Reviewed-by: Alan Donovan <[email protected]>
Run-TryBot: Daniel Martí <[email protected]>
The previous documentation example mentioned
GOFLAGS='-ldflags=-w -ldflags=-s'
, which does something completely different. The second per-package flag overrides the first, so the linker ends up being called with just-s
and not-w -s
.There should be a way to do
go build -ldflags='-w -s'
viaGOFLAGS
. This can either be done by tweakingGOFLAGS
, or by tweaking per-package flags - I personally don't mind, as long as there's a way to achieve it./cc @bcmills @rsc
The text was updated successfully, but these errors were encountered: