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

Incorrect hanling of prerelease in constraints #101

Closed
nbkolchin opened this issue Sep 5, 2022 · 4 comments
Closed

Incorrect hanling of prerelease in constraints #101

nbkolchin opened this issue Sep 5, 2022 · 4 comments

Comments

@nbkolchin
Copy link

  v, _ := version.NewVersion("1.1.8-alpha1")
  if fast_check, err := version.NewConstraint(">= 1.1.7"); err == nil {
    if fast_check.Check(v) {
      fmt.Printf("OK: %v >= 1.1.7\n", v)
    } else {
      fmt.Printf("BUG: %v < 1.1.7\n", v)
    }

Constraint check incorrectly returns false, which is obviously a bug.

@Noksa
Copy link

Noksa commented Oct 5, 2022

Any updates?

@tgross
Copy link
Member

tgross commented Oct 6, 2022

I just ran into this today while working on hashicorp/nomad#14821 and I'd forgotten you need to use the Core() method to get the expected results here. See https://go.dev/play/p/Dq_2dmVV7Dg

@tgross tgross closed this as completed Oct 6, 2022
@nbkolchin
Copy link
Author

It is kinda unclear why we should use Core() here.

@Noksa
Copy link

Noksa commented Oct 11, 2022

I would say It is totally ucnlear

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

No branches or pull requests

3 participants