Debian Codegraph @

/

debian golang-github-aquasecurity-go-pep440-version 0.0.1-1debian golang-github-aquasecurity-go-pep440-version-dev gomod github.com/aquasecurity/go-pep440-version debiangoinimakefilemarkdownshellyaml 21 files · 246 symbols
View dependency graph

Depends on

README (full)

go-pep440-version

Test Go Report Card GitHub

A golang library for parsing PEP 440 compliant Python versions

go-pep440-version is a library for parsing versions of Python software distributions and version specifiers, and verifying versions against a set of specifiers.

Versions used with go-pep440-version must follow PEP 440.

For more details, see pypa/packaging

Usage

Version Parsing and Comparison

See example

v1, _ := version.Parse("1.2.a")
v2, _ := version.Parse("1.2")

// Comparison example. There is also GreaterThan, Equal, and just
// a simple Compare that returns an int allowing easy >=, <=, etc.
if v1.LessThan(v2) {
	fmt.Printf("%s is less than %s", v1, v2)
}

Version Constraints

See example

v, _ := version.Parse("2.1")
c, _ := version.NewSpecifiers(">= 1.0, < 1.4 || > 2.0")

if c.Check(v) {
	fmt.Printf("%s satisfies specifiers '%s'", v, c)
}

Status

  • >
  • >=
  • <
  • <=
  • ==
  • !=
  • ~=
  • ===
dir .github/
dir debian/
dir examples/
file .gitignore
file LICENSE
file README.md
file go.mod
file go.sum
file specifier.go
file specifier_option.go
file specifier_test.go
file version.go
file version_test.go