Skip to content

Comparison against dirty versions fails #141

@ghost

Description

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions