Documentation
¶
Overview ¶
Package semver reads a version of a module, X.Y.Z, and orders two of them by Semantic Versioning 2.0.0, as the format writes a version: three decimal numerals with no leading zero, and no pre-release and no build metadata (format/README.md, sections 26 and 27; R46 spec). Package moduleindex orders the versions of a module by it, for the rule module-index.version-above and the version of a new attempt, and package module the format versions, MAJOR.MINOR, as the versions MAJOR.MINOR.0; package moduleversion orders the published versions of a module by it and raises a version to the next by one of its parts, Raise (R35, R36).
A numeral has no bound, as a version has none, so a Version keeps its numerals as text and orders them by their length first: no version is too large to read or to order.
Index ¶
Constants ¶
const ( Major = iota Minor Patch )
The places of the numbers of a version, from the highest, as Raise and Zero take them.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
A Version is a version of a module, X.Y.Z: its major, minor and patch numbers, each a decimal numeral with no leading zero. Its zero value is no version.
func Parse ¶
Parse reads a version of a module, X.Y.Z, in the form of common.schema.json#/$defs/module_version: three decimal numerals with no leading zero, joined by ".", and nothing else.
func (Version) Compare ¶
Compare gives -1, 0 or +1 as v stands below, at or above w by Semantic Versioning, section 11: by the major number, then the minor, then the patch, each by its value and not its text, so that 1.10.0 stands above 1.9.0.
func (Version) Raise ¶ added in v0.1.23
Raise gives the version with the number at place raised by one and every lower number 0, as a step to the next version by that part does (format/README.md, section 27): 1.2.3 raised at Minor is 1.3.0. The number has no bound: 9 is raised to 10 in its text, digit by digit.