version

package
v0.4.17 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b *Version) int

Compare compares two versions and returns

  • -1 if this version is less than the argument
  • 0 if they are equivalent
  • +1 if the argument is greater than this version

Types

type Version

type Version struct {

	// alignment info
	AlignIndex int // index of the "first point in the version" within the field.Encoded string

	// version info
	Numbers  []int    // Major, Minor, Patch integer values
	Label    string   // e.g. alpha, beta, rc0, rc1, etc
	Metadata []string // darwin, linux, amd64, stripped etc
	// contains filtered or unexported fields
}

Version represents a single SemVer version, used for sorting and alignment.

Version structs are only intended for use for rendering, in [field.Field] structs.

A semver version consists of

  • a major version number
  • a minor version number (optional)
  • a patch number (optional)
  • a single label (optional, e.g. "-alpha", "-dev")
  • any number of meta data tags (optional, e.g. "+linux+amd64+stripped")

See also: [number.Number]

func FromString

func FromString(input string) *Version

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