constraints

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckVersionConstraint

func CheckVersionConstraint(version, constraint string) bool

CheckVersionConstraint checks if a version satisfies a constraint string. Returns true if the version is compatible, false otherwise. An empty constraint is always satisfied.

Supports common constraint operators:

  • Comparison: >=, <=, <, >, ==, !=
  • Caret (compatible): ^1.2 means >=1.2.0, <2.0.0
  • Tilde (patch-level): ~1.2 or ~=1.2 means >=1.2.0, <1.3.0

Multiple constraints can be comma-separated (AND logic). OR groups are supported using "|" or "||" (Composer-style), where any group may match.

func ExtractMinVersion

func ExtractMinVersion(constraint string) string

ExtractMinVersion extracts the minimum version from a constraint string. For constraints like ">=3.8", "^3.10", "~3.9", returns the version number. Returns empty string if no minimum version can be determined.

func NormalizeRuntimeConstraint

func NormalizeRuntimeConstraint(constraint string) string

NormalizeRuntimeConstraint normalizes runtime constraints to a comparable form. Bare versions like "1.70.0" are interpreted as minimum constraints (">=1.70.0").

Types

This section is empty.

Jump to

Keyboard shortcuts

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