-
Notifications
You must be signed in to change notification settings - Fork 75
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
Use build info when available (go install) #265
Use build info when available (go install) #265
Conversation
Thanks for the contribution! Before we can merge this, we need @jmdacruz to sign the Sonatype Contributor License Agreement. |
@jmdacruz Cool! I'll take a look at this. BTW, the CI build will probably succeed if you merge in the latest changes from the |
@bhamail I updated the fork with the upstream, but it looks like there's a an actual integration test failure caused by my code now: Any pointers on what to look for on the integration tests? Update: Found the issue, trying to find a workaround. Long story short, |
780fa16
to
6445a14
Compare
@bhamail done! I documented in the code the behavior of the |
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.
I like it! Thanks!!!
@bhamail I think there's an unintended side effect: The version used when doing
Should I modify the PR to remove the leading |
Good catch. Yes, that sounds like a good change to me. |
Created #266 for fixing this |
Currently, installing nancy via
go install
results innancy --version
returning0.0.0-dev
instead of the version that was actually installed. The solution is to add an init function that usesdebug.ReadBuildInfo()
from theruntime/debug
package in order to get the actual version (if one is available). This is loosely based on the behavior of tools such as https://github.com/golangci/golangci-lint/blob/master/cmd/golangci-lint/mod_version.go#L9This pull request makes the following changes:
init()
function on thebuildversion
package that attempts to retrieve the version information fromdebug.ReadBuildInfo()
(if available, and if the build information is not overridden via the build CLI)cc @bhamail / @DarthHater