semver

package
v0.1.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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; the comparison of versions of a module takes it with T35 (R35).

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

This section is empty.

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

func Parse(s string) (Version, error)

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

func (v Version) Compare(w Version) int

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) String

func (v Version) String() string

String writes the version as X.Y.Z.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL