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

version: Support single override and add git hash. #355

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Sep 12, 2023

This reworks the way versions are handled internally to match other Decred projects such as dcrd and dcrwallet. Namely, it reverse the semantics such that the individual semver components (major, minor, patch, prerelease, and buildmetadata) are parsed from a full string and exported at init time.

Also, since the version is now parsed and verified to be accurate, it updates the pre-release parsing to properly support dots as required by the spec.

Finally, starting with Go version 1.18, it adds the git commit hash to the version string as buildmetadata when no buildmetadata is otherwise specified.

This provides a few main benefits:

  • Allows a single linker override to fully specify the version string instead of having separate ones that can only override the prerelease and build metadata portions
  • Provides run-time checks to ensure the full version string is valid per the semver spec regardless of whether it was specified directly in the source or provided via the linker
  • The exact commit used to build non-release versions will be in the version string by default

Finally, while here, add some comments regarding the release process to help maintainers and add the -V short flag for the version to match other projects for consistency.

@davecgh davecgh force-pushed the version_full_version_override branch from 0729fd5 to 2491667 Compare September 12, 2023 09:02
version_nobuildinfo.go Outdated Show resolved Hide resolved
dcrpool.go Outdated Show resolved Hide resolved
This reworks the way versions are handled internally to match other
Decred projects such as dcrd and dcrwallet.  Namely, it reverse the
semantics such that the individual semver components (major, minor,
patch, prerelease, and buildmetadata) are parsed from a full string and
exported at init time.

Also, since the version is now parsed and verified to be accurate, it
updates the pre-release parsing to properly support dots as required by
the spec.

Finally, starting with Go version 1.18, it adds the git commit hash to
the version string as buildmetadata when no buildmetadata is otherwise
specified.

This provides a few main benefits:

- Allows a single linker override to fully specify the version string
  instead of having separate ones that can only override the prerelease
  and build metadata portions
- Provides run-time checks to ensure the full version string is valid
  per the semver spec regardless of whether it was specified directly in
  the source or provided via the linker
- The exact commit used to build non-release versions will be in the
  version string by default

Finally, while here, add some comments regarding the release process to
help maintainers and add the `-V` short flag for the version to match
other projects for consistency.
@jholdstock jholdstock merged commit 2c44cbe into decred:master Sep 12, 2023
2 checks passed
@davecgh davecgh deleted the version_full_version_override branch September 13, 2023 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants