Skip to content
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

app: log git commit hash #368

Merged
merged 2 commits into from
Apr 6, 2022
Merged

app: log git commit hash #368

merged 2 commits into from
Apr 6, 2022

Conversation

corverroos
Copy link
Contributor

@corverroos corverroos commented Apr 6, 2022

Logs git commit hash and time on startup. Also set commit hash metric and add to version command.

category: feature
ticket: #367

@corverroos
Copy link
Contributor Author

Example charon version output:

➜  charon git:(corver/gitvals) ✗ go build . && ./charon version
v0.2.0 [git_commit_hash=113aba2,git_commit_time=2022-04-06T06:49:02Z]

@corverroos corverroos added the merge when ready Indicates bulldozer bot may merge when all checks pass label Apr 6, 2022

info, ok := debug.ReadBuildInfo()
if !ok {
return hash, timestamp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we returning unknown strings if it is unable to read build info?
Why not return an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it isn't mission critical, it is just "extra information". And it depends on how the binary was built, there is no guarantee that the data is available. For example go run charon/main.go doesn't include this. Neither does go test. So if we return an error, we cannot go run or go test this code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

Copy link
Contributor

@dB2510 dB2510 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@obol-bulldozer obol-bulldozer bot merged commit b029922 into main Apr 6, 2022
@obol-bulldozer obol-bulldozer bot deleted the corver/gitvals branch April 6, 2022 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge when ready Indicates bulldozer bot may merge when all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants