-
Notifications
You must be signed in to change notification settings - Fork 836
Add GO_LDFLAGS for Golang binary build information #1751
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
Add GO_LDFLAGS for Golang binary build information #1751
Conversation
Signed-off-by: Arief Rahmansyah <[email protected]>
|
The output will be like this: Notes:
|
To me, the |
Signed-off-by: Arief Rahmansyah <[email protected]>
|
Am I reading this right: you now have short commit sha in the 'branch' field, and long sha in 'revision' ? Is this what anyone wants? |
| VERSION := $(shell cat VERSION) | ||
| GIT_BRANCH := $(shell ./tools/image-tag) | ||
| GIT_REVISION := $(shell git rev-parse HEAD) | ||
| GO_LDFLAGS := -X github.com/prometheus/common/version.Version=$(VERSION) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this will break in Go 1.14, which will use vendor directory by default, if present and go.mod specifies go 1.14. Vendored dependencies need to be specified as github.com/cortexproject/cortex/vendor/github.com/prometheus/common/version :-(
I think easiest solution to handle both scenarios is to have simple build.go in the Cortex project, that will then set Prometheus values in init method.
|
@ariefrahmansyah Are you still interested into this PR? If so, I would suggest you to rebase |
|
I'm going to close this PR due to inactivity. Feel free to reopen it in case you're still interested into working on this. |
Signed-off-by: Arief Rahmansyah [email protected]