You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be quite useful to be able to add some 'ldflags` when building the binary. For example I usually add a version and commit hash variable to my programs which is updated when building rather than in the code. This is extremely useful for debugging.
An example of using ldflags to set the commit global variable:
go build -ldflags "-X github.com/a/b/main.commit=$(git rev-parse --short HEAD)" .
Other tools like goreleaser also set some flags by default and allow you to customize them as I do with my notify-cli tool. This makes it so when I run notify --version from a binary generated with goreleaser I get the following:
I wonder if adding a config file like .gobinaries.yml with the flags you want to set would be something you would welcome, if so I could help with a PR.
The text was updated successfully, but these errors were encountered:
However it's not working for my project, maybe because it's in a subdirectory?
$ curl -sf https://gobinaries.com/montanaflynn/notify-cli/cmd/notify | sh
==> Downloading github.com/montanaflynn/notify-cli/cmd/notify@master
==> Resolved version master to v0.0.10
==> Downloading binary for darwin amd64
==> Installing notify to /usr/local/bin
==> Installation complete
I'm definitely down for exposing more variables by default, but I'd like to avoid configuration if possible. For more complex builds it might be better to support pre-built binaries (issue #16 )
Prerequisites
Description
It would be quite useful to be able to add some 'ldflags` when building the binary. For example I usually add a version and commit hash variable to my programs which is updated when building rather than in the code. This is extremely useful for debugging.
An example of using
ldflags
to set the commit global variable:go build -ldflags "-X github.com/a/b/main.commit=$(git rev-parse --short HEAD)" .
Other tools like goreleaser also set some flags by default and allow you to customize them as I do with my notify-cli tool. This makes it so when I run
notify --version
from a binary generated with goreleaser I get the following:But with a binary from gobinaries:
I wonder if adding a config file like
.gobinaries.yml
with the flags you want to set would be something you would welcome, if so I could help with a PR.The text was updated successfully, but these errors were encountered: