Help us shape the future of Go! Take the 2026 Go Developer Survey

version

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare added in v0.12.0

func Compare(a string, b string) (int, error)

Compare compares two semantic versions in X.Y.Z form (a leading "v" is allowed and stripped via Normalize). It returns -1 if a < b, 0 if a == b, and 1 if a > b. A non-nil error is returned when either argument is not a valid semantic version.

func IsDev

func IsDev(raw string) bool

IsDev reports whether the version string represents a dev build.

func Normalize

func Normalize(raw string) (string, error)

Normalize validates a semantic version and strips a leading "v". It returns the normalized version in "X.Y.Z" form.

func Parse added in v0.12.0

func Parse(raw string) ([3]int, error)

Parse converts a semantic version into its numeric major/minor/patch components. The input is normalized first (a leading "v" is stripped), so any value accepted by Normalize is accepted here. It returns an error when the version is invalid or a segment cannot be represented as an int.

func ParsePin added in v0.24.0

func ParsePin(data []byte) (string, bool, error)

ParsePin extracts the pinned version from .agent-layer/al.version contents. Blank lines and lines starting with "#" are ignored, and exactly one version line is expected. It returns ok=false with a nil error when the contents hold no version line, and an error when there are multiple version lines or the version line is invalid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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