semver

package
v0.0.0-...-d201a24 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(fromVer, toVer string) (string, error)

Diff will calculate the difference between two semver versions. Since semver are not a well-defined numeric, the subtraction is limited to the difference between leftmost non-zero difference, i.e. if a difference is found in the major numbers, then that difference is returned and the others are represeneted as zeros. E.g. the difference between `2.0.0' and '1.6.99' is '1.0.0'

func Sort

func Sort(versionsRaw []string) []*version.Version

Sort versions in descending order

Sorting require, that we can reliably order the versions. If a mixed versioning scheme is used, e.g. a mix of semver and date-based versions (e.g. '2023-11-11'), then ordering versions without heuristics is impossible. To handle this we only accept semver v2.0.0 versions with the only exception being a leading 'v'.

func Upgrade

func Upgrade(versions []string, constraint string) (string, error)

Upgrade returns the highest version from versions that fulfill constraint

Types

This section is empty.

Jump to

Keyboard shortcuts

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