semver

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

This file was originally vendored from: https://github.com/coreos/go-semver/tree/e214231b295a8ea9479f11b70b35d5acf3556d9b/semver There isn't a single line left from the original source today, but being generous about attribution won't hurt.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare added in v1.10.0

func Compare(a, b string) int

Compare compares two semver strings.

Types

type Version

type Version struct {
	Major      int64
	Minor      int64
	Patch      int64
	PreRelease string `json:"PreRelease,omitempty"`
	Metadata   string `json:"Metadata,omitempty"`
}

Version represents a parsed SemVer

func MustParse added in v1.11.0

func MustParse(version string) Version

MustParse is like Parse but panics if the version string is invalid instead of returning an error.

func Parse added in v1.11.0

func Parse(version string) (v Version, err error)

Parse constructs new semver Version from version string.

func (Version) AppendText added in v1.11.0

func (v Version) AppendText(b []byte) ([]byte, error)

AppendText appends the textual representation of the version to b and returns the extended buffer. This method conforms to the encoding.TextAppender interface, and is useful for serializing the Version without allocating, provided the caller has pre-allocated sufficient space in b.

func (Version) Compare

func (v Version) Compare(other Version) int

Compare tests if v is less than, equal to, or greater than other, returning -1, 0, or +1 respectively. Comparison is based on the SemVer specification (https://semver.org/#spec-item-11).

func (Version) String

func (v Version) String() string

String returns the string representation of the version.

Jump to

Keyboard shortcuts

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