version

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 5 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

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
}

Version represents a semantic version; see https://semver.org/spec/v2.0.0.html.

func MustParse

func MustParse(str string) *Version

MustParse is like Parse but panics on any error. Recommended as an initializer for global values.

func Parse

func Parse(str string) (*Version, error)

Parse creates a version from a string. The string must be a valid semantic version (as per https://semver.org/spec/v2.0.0.html) in the format:

"vMINOR.MAJOR.PATCH[-PRERELEASE][+METADATA]".

MINOR, MAJOR, and PATCH are numeric values (without any leading 0s). PRERELEASE and METADATA can contain ASCII characters and digits, hyphens and dots.

func (*Version) AtLeast

func (v *Version) AtLeast(w *Version) bool

AtLeast returns true if v >= w.

func (*Version) Compare

func (v *Version) Compare(w *Version) int

Compare returns -1, 0, or +1 indicating the relative ordering of versions.

func (*Version) Major

func (v *Version) Major() int

Major returns the major (first) version number.

func (*Version) Metadata

func (v *Version) Metadata() string

Metadata returns the metadata (if present).

func (*Version) Minor

func (v *Version) Minor() int

Minor returns the minor (second) version number.

func (*Version) Patch

func (v *Version) Patch() int

Patch returns the patch (third) version number.

func (*Version) PreRelease

func (v *Version) PreRelease() string

PreRelease returns the pre-release version (if present).

func (Version) String

func (v Version) String() string

String returns the string representation, in the format:

"v1.2.3-beta+md"

Jump to

Keyboard shortcuts

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