version

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package version provides utility types and functions to work with SemVer versions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Label

func Label(v string) string

Label converts version string in SemVer format to label format.

func Prefixes

func Prefixes(v string) labels.Set

Prefixes returns the set of all possible version prefixes for a version string, including itself. Both label and SemVer formats are supported. E.g. for "v1.17.9---vmware.2" the result is: {"v1.17.9---vmware.2": "", "v1.17.9---vmware": "", "v1.17.9": "", "v1.17": "", "v1": ""}

Types

type BuildMetadata

type BuildMetadata []string

BuildMetadata is a structured representation of build metadata in a SemVer version string (the part after '+' in "+vmware.1-...").

func ParseBuildMetadata

func ParseBuildMetadata(s string) BuildMetadata

ParseBuildMetadata creates BuildMetadata from a SemVer version string representation of build metadata (the part after '+' in "+vmware.1-...").

func (BuildMetadata) LessThan

func (bm BuildMetadata) LessThan(other BuildMetadata) bool

LessThan compares BuildMetadata to other BuildMetadata. Returns true if this BuildMetadata represents a less recent build based on numeric (if possible) and alphanumeric comparison of build metadata components.

type Version

type Version struct {
	// contains filtered or unexported fields
}

Version is a structured representation of a SemVer version string (including build metadata).

func ParseSemantic

func ParseSemantic(s string) (*Version, error)

ParseSemantic constructs a structured representation of a semantic version string including build metadata, producing comparable structural representation.

func (*Version) LessThan

func (v *Version) LessThan(other *Version) bool

LessThan compares Version to other Version. Returns true if this Version represents a less recent version based on comparisons of both Versions' SemVer versioning components and build metadata.

func (*Version) Major

func (v *Version) Major() uint

Major returns the major release number.

func (*Version) Minor

func (v *Version) Minor() uint

Minor returns the minor release number.

Jump to

Keyboard shortcuts

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