version

package
v0.0.0-...-b25b198 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: Apache-2.0 Imports: 11 Imported by: 7

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 FromLabel

func FromLabel(label string) string

FromLabel converts label name to version string in SemVer format.

func Fuzz

func Fuzz(v *Version, _ fuzz.Continue)

Fuzz fuzzes the passed version.

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": ""}

func WithV

func WithV(s string) string

WithV makes sure 'v' is prepended to the version string.

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 Compatibility

type Compatibility interface {
	CompatibleVersions(ctx context.Context) (sets.StringSet, error)
}

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.

func (*Version) String

func (v *Version) String() string

Jump to

Keyboard shortcuts

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