Documentation ¶
Overview ¶
Package compatibility offers helper functions for comparing and filtering versions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMajorMismatch signals that the major version of two compared versions don't match. ErrMajorMismatch = errors.New("missmatching major version") // ErrMinorDrift signals that the minor version of two compared versions are further apart than one. ErrMinorDrift = errors.New("version difference larger than one minor version") // ErrSemVer signals that a given version does not adhere to the Semver syntax. ErrSemVer = errors.New("invalid semantic version") // ErrOutdatedCLI signals that the configured version is newer than the CLI. This is not allowed. ErrOutdatedCLI = errors.New("target version newer than cli version") )
Functions ¶
func BinaryWith ¶
BinaryWith tests that this binarie's version is greater or equal than some target version, but not further away than one minor version.
func EnsurePrefixV ¶
EnsurePrefixV returns the input string prefixed with the letter "v", if the string doesn't already start with that letter.
func FilterNewerVersion ¶
FilterNewerVersion filters the list of versions to only include versions newer than currentVersion.
func IsValidUpgrade ¶
IsValidUpgrade checks that a and b adhere to a version drift of 1 and b is greater than a.
func NextMinorVersion ¶
NextMinorVersion returns the next minor version for a given canonical semver. The returned format is vMAJOR.MINOR.
Types ¶
type InvalidUpgradeError ¶
type InvalidUpgradeError struct {
// contains filtered or unexported fields
}
InvalidUpgradeError present an invalid upgrade. It wraps the source and destination version for improved debuggability.
func NewInvalidUpgradeError ¶
func NewInvalidUpgradeError(from string, to string, innerErr error) *InvalidUpgradeError
NewInvalidUpgradeError returns a new InvalidUpgradeError.
func (InvalidUpgradeError) Error ¶
func (e InvalidUpgradeError) Error() string
Error returns the String representation of this error.
func (InvalidUpgradeError) Unwrap ¶
func (e InvalidUpgradeError) Unwrap() error
Unwrap returns the inner error, which is nil in this case.