Skip to content

When compiling mage statically, cannot pass ldflags #320

@tukeJonny

Description

@tukeJonny

Thanks

I'm one user who has used this project.
Thank you so much for always developing and maintaining compatibility!

Requirement (business use case)

Add additional information to mage static binary via -ldflags .

For example, a use case for -ldflags would be if you want to verify that the mage binary is an up-to-date magefile.go binary.

By using -ldflags to embed the hash value in the mage binary, you can compare it with the latest magefile.go's hash to see if it is the latest one.

It's also useful to include Git information.

Problem

Currently, when compiling mage statically, mage doesn't support ldflags flag.

Proposal

Add a new flag -ldflags for mage.

This flag can be used in case of passed -compile flag.

I want to add this flag around here.

Remark

I have a patch for this issue.
So, i can send a PR.
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions