Valid constraints fails to parse
ajhenry opened this issue · comments
When using the following valid semver range: 2 >=2.7.0
, it fails to parse this as a constraint
package main
import (
"fmt"
"github.com/Masterminds/semver"
)
func main() {
_, err := semver.NewConstraint("2 >=2.7.0")
if err != nil {
fmt.Println(err.Error())
}
}
Outputs the following:
improper constraint: 2 >=2.7.0
But this range is valid and equates to >=2.0.0 <3.0.0-0 >=2.7.0
via semver check
The issue here is that you're using semver version 1. You needed a comma to separate them for that version. TO use v3, the current supported version try updating your imports to...
import (
"fmt"
"github.com/Masterminds/semver/v3"
)