version

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: Apache-2.0 Imports: 5 Imported by: 9

Documentation

Overview

Package version implements version handling.

Index

Constants

This section is empty.

Variables

View Source
var (
	// KubeSemver is the regex for Kubernetes versions. It requires the "v" prefix.
	KubeSemver = regexp.MustCompile(`^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)([-0-9a-zA-Z_\.+]*)?$`)
	// KubeSemverTolerant is the regex for Kubernetes versions with an optional "v" prefix.
	KubeSemverTolerant = regexp.MustCompile(`^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)([-0-9a-zA-Z_\.+]*)?$`)
)

Functions

func CompareWithBuildIdentifiers added in v0.4.1

func CompareWithBuildIdentifiers(a semver.Version, b semver.Version) int

CompareWithBuildIdentifiers compares 2 version a and b. Perfoms a standard version compare between a and b. If the versions are equal build identifiers will be used to compare further. -1 == a is less than b. 0 == a is equal to b. 1 == a is greater than b.

func ParseMajorMinorPatch

func ParseMajorMinorPatch(version string) (semver.Version, error)

ParseMajorMinorPatch returns a semver.Version from the string provided by looking only at major.minor.patch and stripping everything else out. It requires the version to have a "v" prefix.

func ParseMajorMinorPatchTolerant

func ParseMajorMinorPatchTolerant(version string) (semver.Version, error)

ParseMajorMinorPatchTolerant returns a semver.Version from the string provided by looking only at major.minor.patch and stripping everything else out. It does not require the version to have a "v" prefix.

Types

This section is empty.

Jump to

Keyboard shortcuts

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