Skip to content

Go gcflags and ldflags can't be specified multiple times #49037

Closed
@kirillx

Description

@kirillx

Most compilers like GCC would take multiple -ldflags arguments, and concatenate them to produce a list of additional arguments to ld.

go build is not doing so, and uses only the last -ldflags. Fortunately it is not completely that bad, and handles -ldflags ""
(an empty argument after -ldflags) as a no-op, so scripting is still possible.

So the proposal is to concatenate multiple gcflags/ldflags. If no objections - would provide PR.

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

$ go version
go version go1.17.1 darwin/amd64

Does this issue reproduce with the latest release?

yes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions