Skip to content

cmd/go: add a way to support GOFLAGS=-ldflags='-w -s' #29096

Closed
@mvdan

Description

@mvdan

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.

/cc @bcmills @rsc

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions