version

package
v0.1.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package version carries the build version, stamped via -ldflags.

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Version is set at build time: -X .../version.Version=v0.x.y

Functions

func Compare

func Compare(a, b string) (result int, ok bool)

Compare orders two version strings: -1 if a is older, 1 if newer, 0 if equal. ok is false when either side is unknown, and callers must not order them.

func Older

func Older(a, b string) bool

Older reports whether a is strictly older than b. An unknown version is not older than anything — it is simply not comparable.

Types

type Parsed

type Parsed struct {
	Major, Minor, Patch int
	// Ahead is the commit count past the tag (the -N- in git describe), so
	// v0.3.1-4-gabc sorts after v0.3.1.
	Ahead   int
	Unknown bool
}

Parsed is a build version broken into comparable parts.

Versions are `git describe` output, not clean semver: "v0.3.1", "v0.3.1-4-gabc1234" (4 commits past the tag) or "dev" on an untagged build. Anything that does not start with a vX.Y.Z tag is Unknown, and an unknown version is never treated as older or newer than a known one — guessing there would let an upgrade planner skip a node it cannot reason about.

func Parse

func Parse(v string) Parsed

Parse breaks a build version string into its parts.

Jump to

Keyboard shortcuts

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