semver

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 2 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

Package semver reads semantic versions and compares them by semantic versioning's precedence: MAJOR.MINOR.PATCH, with an optional prerelease (-rc.1) and build metadata (+build.5), with or without a leading v. The integrations compare the tools' versions with it, and the app's updates compare a release's version with the running build's.

It is a leaf: it imports nothing of the app's.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b string) (int, bool)

Compare compares two versions by semantic versioning's precedence: -1, 0, or 1, and false when either isn't a version.

Types

type Version

type Version struct {
	// contains filtered or unexported fields
}

Version is a parsed MAJOR.MINOR.PATCH[-PRE][+BUILD] version. Build metadata is dropped, since it never changes precedence.

func Parse

func Parse(raw string) (Version, bool)

Parse reads a version, with or without a leading v; ok is false when it isn't one. It holds to semantic versioning 2.0: each prerelease and build identifier is a non-empty run of ASCII letters, digits, and hyphens, and a numeric prerelease identifier has no leading zero (rc.1, never rc.01).

func (Version) Prerelease

func (v Version) Prerelease() bool

Prerelease reports whether v has a prerelease part, as 0.3.0-rc.1 has.

Jump to

Keyboard shortcuts

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