-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
version: don't panic if read build info doesn't work #5210
Conversation
|
It's probably possible, those nested ifs might make it hard to get it right though. I can give it a try. |
@mohammed90 I added a new commit with an early exit branch. Overall I don't think we can save much more ifs, without losing all of the functionality. Let me know which version you think is better. |
@lukedirtwalker Thanks for the PR! And thanks for the review @mohammed90 . Are there any differences in the outputs of these common build methods? i.e. I'm wondering if this patch changes anything, or if it simply avoids the panic. (I'd prefer to just avoid the panic.)
|
If `debug.ReadBuildInfo()` doesn't return the build information we should not try to access it. Especially if users only want to build with the `CustomVersion` we should not assume access to `debug.ReadBuildInfo()`. The build environment where this isn't available for me is when building with bazel.
a80310b
to
5675fd2
Compare
Finally had time to check it: Currently (e10ed7b):
With patch based on e10ed7b:
|
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.
Awesome, so that looks like there are no changes to the current output, and simply fixes the panic. Thank you!
* version: don't panic if read build info doesn't work If `debug.ReadBuildInfo()` doesn't return the build information we should not try to access it. Especially if users only want to build with the `CustomVersion` we should not assume access to `debug.ReadBuildInfo()`. The build environment where this isn't available for me is when building with bazel. * exit early
If
debug.ReadBuildInfo()
doesn't return the build information we should not try to access it. Especially if users only want to build with theCustomVersion
we should not assume access todebug.ReadBuildInfo()
.The build environment where this isn't available for me is when building with bazel.