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

Comments

Projects
None yet
3 participants
@mhr3
Copy link

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

This comment has been minimized.

Copy link
Member

commented Aug 30, 2018

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

@agnivade

This comment has been minimized.

Copy link
Member

commented Aug 30, 2018

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

@agnivade agnivade closed this Aug 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.