Caret operator (^) gives unexpected results when the minor version in constraint is 0(zero)
arshchimni opened this issue · comments
Arshdeep Singh Chimni commented
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
Line 497 in 49c09bf
Go Playground link -> https://go.dev/play/p/mO_fog7Cyc2