cmpver

package
v0.0.0-...-113f59a Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package cmpver implements a variant of debian version number comparison.

A version is a string consisting of alternating non-numeric and numeric fields. When comparing two versions, each one is broken down into its respective fields, and the fields are compared pairwise. The comparison is lexicographic for non-numeric fields, numeric for numeric fields. The first non-equal field pair determines the ordering of the two versions.

This comparison scheme is a simplified version of Debian's version number comparisons. Debian differs in a few details of lexicographical field comparison, where certain characters have special meaning and ordering. We don't need that, because Tailscale version numbers don't need it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(v1, v2 string) int

Compare returns an integer comparing two strings as version numbers. The result will be 0 if v1==v2, -1 if v1 < v2, and +1 if v1 > v2.

Types

This section is empty.

Jump to

Keyboard shortcuts

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