version

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(v1, v2 string) int

Compare compares two semantic version strings. Returns -1 if v1 < v2, 0 if v1 == v2, or 1 if v1 > v2. Handles versions with different numbers of components by treating missing components as 0.

func ExtractMajor

func ExtractMajor(v string) int

ExtractMajor extracts the major version number from a version string. For example, "v1.2.3" returns 1.

func ExtractMajorMinor

func ExtractMajorMinor(v string) (int, int)

ExtractMajorMinor extracts the major and minor version numbers from a version string. For example, "v1.2.3" returns (1, 2).

func Normalize

func Normalize(version string) string

Normalize normalizes a version string by removing leading/trailing whitespace and the "v" prefix if present (e.g., "v1.2.3" becomes "1.2.3").

func ToMajorTag

func ToMajorTag(v string) string

ToMajorTag converts a version string to just the major version tag. For example, "v5.2.0" returns "v5", "5.2.0" returns "v5".

Types

This section is empty.

Jump to

Keyboard shortcuts

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