Masterminds / Masterminds/semver
`Checking Version Constraints` is unpredictable while patch is missing in version string
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 168
- PR merge metrics
- No merged PRs in 30d
Description
When I was trying to validate version 14.1.1-debian against constraints 14.1.1-alpine, it was giving error like 14.1.1-debian is not equal to 14.1.1-alpine which is expected.
But when I was trying version 14.1-debian against constraints 14.1-alpine, it was considered as valid version which is not expected to me.
semver version: v3.1.1
For reproducing the error, I have given my go code below:
package main
import (
"fmt"
"github.com/Masterminds/semver/v3"
"log"
)
func main() {
c, err := semver.NewConstraint("14.1-alpine")
if err != nil {
log.Fatalln(err)
}
v, err := semver.NewVersion("14.1-debian")
if err != nil {
log.Fatalln(err)
}
valid, errs := c.Validate(v)
if len(errs) > 0 {
log.Fatalln(errs)
}
fmt.Println(valid)
}
Output:
true
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 with the Go entry points shown in the report: NewConstraint, NewVersion, and Validate. Run the provided reproduction and trace how the missing patch component is compared; done means the 14.1-debian version is not accepted for the 14.1-alpine constraint, while the reported complete versions retain their expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100