Masterminds / semver

Work with Semantic Versions in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comparison against dirty versions fails

opened this issue · comments

I notice that with v3.0.1 and v.3.0.2 the comparison fails when the constraint is build with a dirty version (eg. 4.5).

  func main() {
	versionConstraint, err := semver.NewConstraint("1.5.0 - 4.5")
	if err != nil {
		return
	}

	currVersion, err := semver.NewVersion("3.7.0")
	if err != nil {
		return
	}

	fmt.Println(versionConstraint.Check(currVersion))
}

In The Go Playground, where v.1.5.0 is used, there is no such a bug.
From debugging I see that the problem is in constraints.go, line 404 (v3.0.1)