hashicorp / go-version

A Go (golang) library for parsing and verifying versions and version constraints.

Home Page:https://pkg.go.dev/github.com/hashicorp/go-version

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Patch version comparison bug

alexey-igrychev opened this issue · comments

The version with patch version prefix is lower than the same version without:

v1, _ := version.NewVersion("1.0.0-rc1")
v2, _ := version.NewVersion("1.0.0")
v1.LessThan(v2) // true

This is not a bug, just semver logic

When major, minor, and patch are equal, a pre-release version has lower precedence than a normal version.