-
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
NewConstraint method faulty behavior #185
Comments
FYI: the used regex to validate the contstraint fails: https://regex101.com/r/3fEGeK/1 |
I can explain what's going on here.
|
Ah I'm sorry, had to correct the 2 faulty examples, there were copy paste typos. expected behavior? Its a non semver string with 4 parts like in the first example, but handled differently. The third dot is removed and its a valid range? Wy is |
I have verified the issue. https://go.dev/play/p/wMEsKXb5KEx |
Closes Masterminds#185 Validation of strings was producing false positives when there were too many sections. A string like 1.2.3.1234 would be found in error but on like 1.23.3.1234 or 1.2.34.1234 could pass even though it had too many segments. This is because a string like 1.23.3.1234 would be found as two different constraints of 1.1 and 3.3.1234. The fix was to treat validation for the the first and following constraints separately. For for the following ones a space or command is now required before it to show it's a second or further one. Signed-off-by: Matt Farina <[email protected]>
@benjaminbear The fix can be found in #186 and the commit message explains what happened to cause this. I am planning on getting a new release out by the end of this week with some fixes and new functionality. Feel free to double check my fix and tell me if it didn't work. |
Great to hear! Thank you very much @mattfarina |
Used version: 3.1.1
When I try to create a constraint with NewConstraint method I get following returns:
good Example
c, cErr := semver.NewConstraint("12.3.4.1234")
c.String() = nil
cErr = "improper constraint: 12.3.4.1234"
faulty behavior
c, cErr := semver.NewConstraint("12.23.4.1234")
c.String() = "12.23.4 1234"
cErr = nil
or
c, cErr := semver.NewConstraint("12.3.34.1234")
c.String() = "12.3.34 1234"
cErr = nil
I would expect the same behavior as with "12.3.4.1234", means telling me its not a contraint..
The text was updated successfully, but these errors were encountered: