Fork me on GitHub

go-versions

The version scheme real packages actually use โ€” a faithful Go port of pkgx's, for the versions strict semver rejects.

libpkgx-faithfulopenssl-style versionsCGO_ENABLED=0BSD-3-Clause
zsh
$ go get github.com/go-versions/semver@latest
One organisation, 1 repositories

The real world ships many โ€œalmost validโ€ versions โ€” 1.1.1w and its kin โ€” that node-semver and the Go semver libraries simply refuse. A package manager cannot refuse them back, so it needs a scheme that accepts what upstreams actually publish.

This is that scheme, ported faithfully rather than approximated, and it is the parsing and comparison implementation behind the go-pkgx family.

Repositories

semver parser

ParseVersion / comparison, libpkgx semantics

semver.ParseVersion("1.1.1w") โ€” openssl-style and the rest of what pkgx accepts, with the same ordering.

CI Go reference

Faithful means tested against the reference behaviour, not merely inspired by it โ€” the point of a port is that it agrees with the original on the awkward inputs, which are the only ones that matter here.