Skip to content
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

Caret operator (^) gives unexpected results when the minor version in constraint is 0(zero) #180

Closed
arshchimni opened this issue Aug 3, 2022 · 0 comments · Fixed by #181
Labels

Comments

@arshchimni
Copy link
Contributor

arshchimni commented Aug 3, 2022

Hi Community.
Thank you for this helpful library.
I came across an issue today with the latest version while implementing the following constraint

"^0.0.1"

According to the docs, this should exactly match only the 0.0.1 version and nothing else.
But it matches any minor version update as long as the patch is 1, ie; if we pass 0.3.1 the above constraint passes, but 0.3.0 fails.

This happens because we do not check for the case when the minor version is set to 0(zero) in a caret constraint defined in the function

func constraintCaret(v *Version, c *constraint) (bool, error) {

Go Playground link -> https://go.dev/play/p/mO_fog7Cyc2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants