v1.0.4 Latest Latest

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

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



Package semver provides shared utilities for manipulating Go semantic versions.



This section is empty.


This section is empty.


func Affects

func Affects(a []osv.Range, v string) bool

func ContainsSemver added in v1.0.2

func ContainsSemver(ar osv.Range, v string) bool

ContainsSemver checks if semver version v is in the range encoded by ar. If ar is not a semver range, returns false. A range is interpreted as a left-closed and right-open interval.

Assumes that

  • exactly one of Introduced or Fixed fields is set
  • ranges in ar are not overlapping
  • beginning of time is encoded with .Introduced="0"
  • no-fix is not an event, as opposed to being an event where Introduced="" and Fixed=""

func GoTagToSemver

func GoTagToSemver(tag string) string

This is a modified copy of pkgsite/internal/stdlib:VersionForTag.

func Less

func Less(v1, v2 string) bool

Less returns whether v1 < v2, where v1 and v2 are semver versions with either a "v", "go" or no prefix.

func NonSupersededFix added in v1.0.2

func NonSupersededFix(ranges []osv.Range) string

NonSupersededFix returns a fixed version from ranges that is not superseded by any other fix or any other introduction of a vulnerability. Returns "" in case there is no such fixed version.

func Valid added in v0.2.0

func Valid(v string) bool

Valid returns whether v is valid semver, allowing either a "v", "go" or no prefix.


This section is empty.

Jump to

Keyboard shortcuts

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