version

package
v0.2.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: Apache-2.0 Imports: 5 Imported by: 2 modules, 2 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

Overview

Package version contains important methods and constants for github release.

Package version contains important structs and methods for cluster stack versions.

Index

Constants

View Source
const (
	// ChannelStable is the stable channel.
	ChannelStable = Channel("stable")
	// ChannelCustom is the custom channel where git hash is used in the versioning.
	ChannelCustom = Channel("custom")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel string

Channel is the release channel of a cluster stack.

func (Channel) IsValid

func (c Channel) IsValid() bool

IsValid returns true if the release channel is valid.

type Version

type Version struct {
	Major   int
	Channel Channel
	Patch   string
}

Version encapsulates a Version string into its constituent parts as a struct. Sample: Version string "v1-alpha-1" Major: "v1" major: 1 (int, after stripping "v" prefix) Channel: "alpha" Patch: 1.

func FromReleaseTag

func FromReleaseTag(releaseTag string) (Version, error)

FromReleaseTag returns a Version struct from a release tag string.

func New

func New(version string) (Version, error)

New returns a Version struct from a version string Sample allowed inputs: "v1-alpha.1", "v1", "v1-alpha.0" Sample disallowed inputs: "v1-alpha", "v1-alpha-1.0", "v1-alpha-1.0.0", "v1-alpha.", "v1.0-alpha.1".

func ParseVersionString

func ParseVersionString(version string) (Version, error)

ParseVersionString returns a Version struct from a version string like - "v1", "v1-alpha-1", "v1-beta-3", etc.

func (Version) Compare

func (csv Version) Compare(input Version) (int, error)

Compare compares two Version structs Returns 1 if csv is greater than input Returns -1 if csv is less than input Returns 0 if csv is equal to input Returns error if the two versions are not comparable (different channels).

func (Version) String

func (csv Version) String() string

String converts a Version struct to a string representation. If the channel is stable, it returns the version in the format "vMajor". Otherwise, it returns the version in the format "vMajor-Channel-Patch".

func (Version) StringWithDot

func (csv Version) StringWithDot() string

StringWithDot converts a Version struct to a string representation. If the channel is stable, it returns the version in the format "vMajor". Otherwise, it returns the version in the format "vMajor-Channel.Patch", similar to String but with a dot separating channel and patch.

func (*Version) Validate

func (csv *Version) Validate() error

Validate validates the version.

Jump to

Keyboard shortcuts

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