-
Notifications
You must be signed in to change notification settings - Fork 330
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
Show git commit if version information is missing #1517
Conversation
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.
Thanks very much for this patch, I think this will be helpful for bug reports.
One minor thing is that I'm not sure how useful vcs.time
is, although I guess it can't hurt to include it anyway. Otherwise I don't have much opinion on the format of the version output, and overall the PR looks fine to me.
Thanks for reviewing! I actually find the |
Cool no worries, I will give my approval then. Thanks once again. |
Thanks for the PR! Two minor suggestions:
I was also thinking about an alternative plan: --version could just print the commit id, and there could be a separate --verbose-version option to print everything (including the official version, if present). However, I decided we don't really have to think about that too hard now. We can merge this and then see whether there's a demand for something more complicated. |
@ilyagr Thanks! I've updated the format to now look like the followng:
|
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.
Thank you! LGTM.
This uses
runtime/debug
to show the Go version and Git commit embedded in the binary if version information is missing. The previous behavior is to just print nothing if the version is missing which is not very helpful.I also considered adding the Go version information to the regular version information, but decided against it in case someone parses the output from the current version command.
Example output of custom built binary: