version

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package version contains dpkg version string functions (parsing, comparison) which are compatible with dpkg(1)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a Version, b Version) int

Compare compares the two provided Debian versions. It returns 0 if a and b are equal, a value < 0 if a is smaller than b and a value > 0 if a is greater than b.

Types

type Slice

type Slice []Version

Slice is a slice versions, satisfying sort.Interface

func (Slice) Len

func (a Slice) Len() int

func (Slice) Less

func (a Slice) Less(i, j int) bool

func (Slice) Swap

func (a Slice) Swap(i, j int)

type Version

type Version struct {
	Epoch    uint
	Version  string
	Revision string
}

func Parse

func Parse(input string) (Version, error)

Parse returns a Version struct filled with the epoch, version and revision specified in input. It verifies the version string as a whole, just like dpkg(1), and even returns roughly the same error messages.

func (*Version) Empty

func (v *Version) Empty() bool

func (*Version) IsNative

func (v *Version) IsNative() bool

func (Version) MarshalControl

func (version Version) MarshalControl() (string, error)

func (*Version) MarshalText

func (version *Version) MarshalText() ([]byte, error)

func (Version) String

func (v Version) String() string

func (Version) StringWithoutEpoch

func (v Version) StringWithoutEpoch() string

func (*Version) UnmarshalControl

func (version *Version) UnmarshalControl(data string) error

func (*Version) UnmarshalText

func (version *Version) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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