Documentation
¶
Overview ¶
Package semver is a small, dependency-free Semantic Versioning 2.0.0 parser and comparator, sufficient for Rune's `minimum_version` requirement gate. It deliberately implements only what the gate needs — parse, precedence compare, and a `>=` satisfaction test — rather than a full constraint language.
Precedence follows SemVer 2.0.0: the numeric core is compared first, a prerelease ranks below the otherwise-equal release (so 0.9.0-rc.1 < 0.9.0), prerelease identifiers are compared field-by-field (numeric identifiers rank below alphanumeric ones), and build metadata is ignored entirely.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Version ¶
type Version struct {
Major, Minor, Patch int
Prerelease []string // dot-separated identifiers; empty for a release
Build []string // build metadata; ignored for precedence
}
Version is a parsed semantic version. Build metadata is retained for round-tripping but never affects precedence.
func Parse ¶
Parse parses a semantic version of the form MAJOR.MINOR.PATCH[-pre][+build]. A leading "v", a partial core (e.g. "0.8"), leading zeros in numeric fields, and empty identifiers are rejected.
func (Version) Compare ¶
Compare returns -1, 0, or +1 as v is less than, equal to, or greater than o in SemVer precedence. Build metadata is ignored.