-
Notifications
You must be signed in to change notification settings - Fork 151
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
Bug: Constraints::Check(...) function mistakenly returns false, expected true #46
Comments
Hm, what is the expected behavior here with “~”. We only implement “-“ as a separator internal since that is what the SemVer spec defines clearly. I’m not familiar with how software might version using the tilde separator, perhaps we just consider it equal in behavior to “-“ which would yield the correct behavior in your report? |
"~" can have multiple meanings, e.g. for pre-released debian packages:
|
Hm, yeah that’s kind of awkward to special case in there. I would want to gather a few more examples of this in use before using it. For now, if you string replace “~” with “-“ you will probably get the right behavior. There are definitely edge cases and I don’t mean for that to be your solution, but I wouldn’t be comfortable jamming in any special handling for “~” until there was a wider survey done to see if that’s (1) common enough and (2) the consensus for what it means. |
I tried replacing v1 := MustVersion("1.7.3")
v2 := MustVersion("1.7.4-pre.0")
v3 := MustVersion("1.7.4")
if !v1.LessThan(v2) {
panic("v1 not less than v2")
}
if !v2.LessThan(v3) {
panic("v2 not less than v3")
}
if !v1.LessThan(v3) {
panic("v1 not less than v3")
}
c := MustConstraint(">= 1.7.3")
if !c.Check(v1) {
panic("constraint failed for v1")
}
if !c.Check(v3) {
panic("constraint failed for v3")
}
if !c.Check(v2) {
panic("constraint failed for v2")
} Output: Hmm .. |
I have the same issue as @Codehardt. Is there a plan to fix this issue? We're currently using version 1.2.0 of go-version |
Hey,
the following example shows an unexpected behavior of the constraints' check function:
My output is
constraint failed for v2
. The above code shows, that1.7.3
is less than1.7.4~pre.0
but1.7.4~pre.0
does not match constraint>= 1.7.3
.Tested commit: v1.1.0
d40cf49b3a77bba84a7afdbd7f1dc295d114efb1
Thanks,
Marcel Gebhardt
The text was updated successfully, but these errors were encountered: