Documentation
¶
Overview ¶
Package semver is a faithful Go port of pkgx's version scheme (libpkgx's semver.ts). It is deliberately NOT strict SemVer 2.0: open-source ships many "almost valid" versions that node-semver and the Go semver libraries reject — openssl 1.1.1w (a trailing letter), ghc 5.64.3.2 (four components), bare v-prefixes — plus pkgx's own `@` range operator and CalVer sorting. This is the shared implementation for the go-pkgx family (bottle/pkgm/pkgx/mirror/bk).
Index ¶
- type Range
- type Version
- func (v *Version) Compare(that *Version) int
- func (v *Version) EQ(o *Version) bool
- func (v *Version) GT(o *Version) bool
- func (v *Version) GTE(o *Version) bool
- func (v *Version) LT(o *Version) bool
- func (v *Version) LTE(o *Version) bool
- func (v *Version) NEQ(o *Version) bool
- func (v *Version) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
Range is a pkgx version constraint: `*`, `^1`, `~1.2`, `<3`, `=1.2.3`, `@5`, `>=1 <2`, or several of those joined by `,` / `||`.
func Intersect ¶
Intersect returns the range satisfied by both a and b, or an error when they are disjoint.
func ParseRange ¶
ParseRange is the tolerant range parser: a bare version (eg. "5.1") that isn't a valid range is treated as `@5.1`, matching what users expect.
type Version ¶
type Version struct {
Components []int
Major, Minor, Patch int
Raw string
// contains filtered or unexported fields
}
Version is a parsed pkgx version. Components holds every numeric part (a trailing letter like the "w" in 1.1.1w becomes its 1-based alphabet index).
func MustParseVersion ¶
MustParseVersion is ParseVersion but panics on error — for constants/tests.
func ParseVersion ¶
ParseVersion parses a version string, tolerating pkgx's loose scheme.