-
Notifications
You must be signed in to change notification settings - Fork 152
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
strict version check constraint bug (or expected?) #242
Comments
Please see the documentation on working with pre-releases as it explains the behavior you are seeing. Many tools and libraries in this space require you to opt-in to using pre-releases. They do this out of experience in this space as pre-releases may (and sometimes) are not compatible with the stable release guarantees. The constraint needs to opt-in to pre-releases. You'll find the same behavior in other places like JavaScript and Rust. |
For what is documented in the semver:
What about this one:
How to identify builds from releases without build in it? Which have the exact same issue here. |
I will start with build metadata. The spec says...
When comparing versions they are considered the same. On pre-releases the spec states...
In the past, this library did not opt-in for pre-releases and that caused problems. Many other tools opt-in to pre-releases. Just because pre-release is a valid semver does not mean comparison systems MUST handle them along stable release versions by default. There is no spec for filtering tooling. |
@mattfarina Hello. c, _ := semver.NewConstraint("> 1.1.1")
v, _ := semver.NewVersion("v2.2.2-alpha1")
a := c.Check(v)
// Output: false meanwhile the constraint I guess, we can affirm, that the prerelease
What I might have missed in this logic? |
Hello!
I actually saw that the version constraint sometimes does not work as expected, as you can see here: https://go.dev/play/p/u1nq3v1-SiS
I got the following versions:
here is a usable snippet:
What I got:
What I was expecting:
If this was the expected behaviour:
The text was updated successfully, but these errors were encountered: