ver

package
v0.28.3 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrPartsCount              = "parts count error: %v vs %v"
	ErrVersionsAreIncomparable = "versions are incomparable: %v vs %v"
)
View Source
const (
	VersionFormat = "v%d.%d.%d%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Version

type Version struct {
	Major   uint
	Minor   uint
	Patch   uint
	Postfix string
}

func CleanVersions

func CleanVersions(in []*Version) (out []*Version)

CleanVersions filters an array of versions leaving only clean versions.

func LatestVersion

func LatestVersion(vs []*Version) (lv *Version)

LatestVersion returns the latest version of specified versions.

func New

func New(versionStr string) (v *Version, err error)

func (*Version) IsClean

func (v *Version) IsClean() bool

IsClean checks whether the version has only numeric information without any postfixes. For example, 'v0.1.2' version is clean, but 'v0.1.2-rc5' is not clean.

func (*Version) IsEqualTo

func (v *Version) IsEqualTo(that *Version) (isEqual bool)

IsEqualTo tells if the version is equal to a specified version.

func (*Version) IsGreaterThan

func (v *Version) IsGreaterThan(that *Version) (isGreater bool, err error)

IsGreaterThan tells if the version is greater than a specified version.

func (*Version) ToString

func (v *Version) ToString() string

ToString returns a textual representation of a version. This representation may be slightly different from the original parsed version while this object uses its own format for formatting versions. E.g. a version parsed from 'Ver.1.2.3' will be formatted as 'v1.2.3'.

Jump to

Keyboard shortcuts

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