version

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 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.1

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.1

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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