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: build fails to parse GOFLAGS #27368

Closed
mhr3 opened this issue Aug 30, 2018 · 2 comments
Closed

cmd/go: build fails to parse GOFLAGS #27368

mhr3 opened this issue Aug 30, 2018 · 2 comments

Comments

@mhr3
Copy link

mhr3 commented Aug 30, 2018

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

go version go1.11 linux/amd64

Does this issue reproduce with the latest release?

yes

What did you do?

Running GOFLAGS="-ldflags '-w -s'" go build pkgname produces an error with go 1.11 (used to work fine with 1.10):

go: parsing $GOFLAGS: non-flag "'-w"

The flag still works when passed directly to go build, but if the env var is set, the compilation fails.

@myitcv
Copy link
Member

myitcv commented Aug 30, 2018

cc @bcmills

@myitcv myitcv changed the title go build fails to parse GOFLAGS cmd/go: build fails to parse GOFLAGS Aug 30, 2018
@agnivade
Copy link
Contributor

You are setting the flags incorrectly. https://tip.golang.org/cmd/go/#hdr-Environment_variables

Each flag need to be space-separated and standalone. GOFLAGS="-ldflags=-w -ldflags=-s".

Also see - #27282

@golang golang locked and limited conversation to collaborators Aug 30, 2019
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

4 participants