-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
cmd/version: Commit hash #3327
cmd/version: Commit hash #3327
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #3327 +/- ##
==========================================
- Coverage 73.20% 73.01% -0.19%
==========================================
Files 258 256 -2
Lines 19895 19910 +15
==========================================
- Hits 14564 14538 -26
- Misses 4406 4439 +33
- Partials 925 933 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. 📢 Have feedback on the report? Share it here. |
19a769c
to
d6a8a1e
Compare
29f7aeb
to
87e8a3a
Compare
87e8a3a
to
d63fb1e
Compare
b3a0ba6
to
454aa3d
Compare
) | ||
for _, s := range buildInfo.Settings { | ||
switch s.Key { | ||
case "vcs.revision": |
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.
We even have vcs.time
so ... I guess we can even add that if somebody wants 🤷
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.
This is awesome 👍🏻
What?
Before we were injecting the version details via ldflags. go1.18 introduced the ability to detect the commit directly from the code.
An example of the new format:
Why?
We benefit from it for simplifying our build process and making it more reproducible. It now prints the commit hash instead of the timestamp, in this way should be easier to use in case of troubleshooting and reports.
Related PR(s)/Issue(s)
The original discussion where it started #3322 (comment)