Masterminds / Masterminds/semver
Distinguish between zero values and missing values
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 168
- PR merge metrics
- No merged PRs in 30d
Description
I have a need to distinguish between "2" and "2.0" post-parsing, without having to re-parse these strings.
For example, I am writing an automated system to identify when software component versions are no longer supported. The data about support timelines can vary about specificity, so that some products exit support as of a major-wide series 2.x ("2"), whereas other products develop at a much faster rate and can exit support as of particular minor versions ("2.0").
Unfortunately, it appears that semver simply defaults unspecified minor version values, etc. etc. as zero, without providing a clear way to distinguish between an explicit zero input, versus an implicit default of missing information to zero.
I think I may hack around this gap by counting the periods in the original version string prior to parsing with semver. But I would love for a standard feature such as HasMinor(), HasPatch(), HasBuild(), to clarify in a reliable way.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the semver parsing API and how it represents omitted minor, patch, and build components. Define how callers can distinguish an explicit zero from a missing value, including the requested HasMinor(), HasPatch(), and HasBuild() behavior. Done means parsed versions reliably expose that distinction without requiring callers to re-parse the original string.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100