v0.16.0 Latest Latest

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

Go to latest
Published: Oct 31, 2023 License: BSD-3-Clause, MIT Imports: 5 Imported by: 24



version is a pure-go implementation of dpkg version string functions (parsing, comparison) which is compatible with dpkg(1).



This section is empty.


This section is empty.


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.


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 added in v0.13.0

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

func (Version) String

func (v Version) String() string

func (Version) StringWithoutEpoch added in v0.15.0

func (v Version) StringWithoutEpoch() string

func (*Version) UnmarshalControl

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

func (*Version) UnmarshalText added in v0.13.0

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