/p/moul/x/daily/semver/v0
gno.land/p/moul/x/daily/semver/v0
Semantic Versioning 2.0.0 parser + comparator — Parse, Compare, and the
Version type (with Canonical).
An on-chain port of the core of Go's golang.org/x/mod/semver
(and the spirit of Masterminds/semver).
Parses vMAJOR.MINOR.PATCH[-prerelease][+build] and compares with correct
precedence: numeric fields compare numerically (so 1.2.3 < 1.2.10), a
pre-release ranks below its release (1.0.0-alpha < 1.0.0), numeric pre-release
identifiers rank below alphanumeric ones, and build metadata is ignored. Pure
and deterministic — no avl, no chain imports, no ambient state.
1import "gno.land/p/moul/x/daily/semver/v0"
2
3v, err := semver.Parse("v1.0.0-rc.1+ci.7") // Version{Major:1, Pre:["rc","1"], …}
4semver.Compare("1.2.3", "1.2.10") // -1
5v.Canonical() // "1.0.0-rc.1+ci.7"
Live demo: r/moul/x/daily/semverdemo
· render it at /r/moul/x/daily/semverdemo/v0.
Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.
🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.