-
Notifications
You must be signed in to change notification settings - Fork 161
Description
semver.NewConstraint seems to always do fuzzy matching, even when no relational operators are specified, and even if '=' operator is used.
Example:
func main() {
tests := [...][2]string{
{"1.0-af839ds6", "1.0-ff164935"},
{"=1.0-af839ds6", "1.0-ff164935"},
{"1.0+af839ds6", "1.0+ff164935"},
{"=1.0+af839ds6", "1.0+ff164935"},
}
for i := 0; i < len(tests); i++ {
c, err := semver.NewConstraint(tests[i][0])
if err != nil {
return
}
v, err := semver.NewVersion(tests[i][1])
if err != nil {
return
}
log.Printf("%s check %s => %t", c, v, c.Check(v))
}
}All these checks produce true.
Is there a way to specify a constraint that would require exact match of all components, including preprelease and build metadata components of the version? I would expect it to happen with '=' operator, but currently the matching is still fuzzy.
This is somewhat similar to #164, except that I don't need any pattern at all, just plain exact match.
My use case also involves helm. I want to tell it to use exact build of the helm chart, and make it fail if it does not find exact match. Currently, if helm does not find exact match, it uses semver.NewConstraint and looks for a version that matches the constraint. And the constraint gives such unexpected matches, as in the example above.