versioncmp

package
v3.0.0-rc49 Latest Latest
Warning

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

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

Documentation

Overview

Package versioncmp compares the versions of the tools the drivers depend on, as "lxc-info --version" or "virsh --version" print them.

Those are no semantic versions: a distribution appends its own suffix, as "5.0.0~git2209-g5a7b9ce67" or "4.0.12-0ubuntu1~20.04.1", so only the numeric components are compared.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtLeast

func AtLeast(v, min string) (bool, error)

AtLeast says whether the version v is min or newer.

func Compare

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

Compare returns -1, 0 or 1 as the version a is older than, the same as, or newer than the version b. A component one has and the other has not is compared to 0, so 2.1 and 2.1.0 are the same.

func Newer

func Newer(v, than string) (bool, error)

Newer says whether the version v is newer than than.

func Parse

func Parse(s string) ([]int, error)

Parse returns the numeric components of a version: the dot separated numbers it starts with, after an optional "v", up to the first character that is neither a digit nor a dot. "5.0.0~git2209" is [5 0 0].

Types

This section is empty.

Jump to

Keyboard shortcuts

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