refactor: remove 'version.Get()' and only use 'version.Raw()'#445
Open
refactor: remove 'version.Get()' and only use 'version.Raw()'#445
Conversation
Move the v-prefix enforcement from Get() into init(), ensuring Version is normalized at startup. This eliminates the confusing Get() vs Raw() distinction — Raw() is now the single way to access the version.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #445 +/- ##
==========================================
+ Coverage 70.32% 70.35% +0.02%
==========================================
Files 220 220
Lines 18506 18506
==========================================
+ Hits 13015 13020 +5
+ Misses 4313 4311 -2
+ Partials 1178 1175 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mwbrooks
commented
Mar 27, 2026
Member
Author
mwbrooks
left a comment
There was a problem hiding this comment.
A few notes for the semantic minded versioners 🔢
| if envVersion := getVersionFromEnv(); envVersion != "" { | ||
| Version = envVersion | ||
| } | ||
| Version = ensurePrefix(Version) |
Member
Author
There was a problem hiding this comment.
note: We now enforce the v prefix on init() so that all version-pathways will now have a v prefix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
Summary
This pull request removes
version.Get()and only usesversion.Raw(). The motivation is the simplify version handling to be 1 method instead of 2 methods.Context:
PR #429 consolidated version handling to prefer
version.Raw()andslackcontext.Version(ctx). A follow-up task was to removeversion.Get()entirely since it creates confusion about which function to use. The only difference is that.Get()prepends avprefix if missing - but we can guarantee thevprefix is always present without requiring.Get().Why it's Safe to Remove:
The
vprefix is already guaranteed in all code paths that set Version:git describe --tags --match 'v*.*.*'- the--matchpattern requires a v-prefixed tag, and git describe outputs the matching tag name, so the result always starts withv."v0.0.0-dev"- already has the prefix.SLACK_TEST_VERSION- this is the one gap. QA testers could set it without av. This PR adds validation by moving the v-prefix enforcement from.Get()intoinit(), ensuring Version is normalized at startup.Open Question 🧠
version.Raw()toversion.Version()?version.Major(),version.Minor(), etc to get specific elements of the version.Requirements