Documentation ¶
Overview ¶
Package semver implements comparison of semantic version strings.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compare ¶
Compare returns an integer comparing two versions according to semantic version precedence. The result will be 0 if v == w, -1 if v < w, or +1 if v > w.
An invalid semantic version string is considered less than a valid one. All invalid semantic version strings compare equal to each other.
Types ¶
type Tag ¶
type Tag interface { Build() string Canonical() string IsTag() bool IsValid() bool Major() string MajorMinor() string Prerelease() string fmt.Stringer }
Tag represents a version.
func LatestMinor ¶
LatestMinor returns the latest minor version of the given major.
func LatestPatch ¶
LatestPatch returns the latest version with this major and minor.
type Tags ¶
type Tags []Tag
Tags represents a list of versions that can be sorted.
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
Version represents a semantic version.
func (Version) MajorMinor ¶
MajorMinor implements the Tag interface.
func (Version) Prerelease ¶
Prerelease implements the Tag interface.