semver

package
v2.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package semver provides the minimal major.minor.patch handling the release flow and the required_version check need.

Every entry point accepts both spellings a version reaches cidx with: the tag form ("v2.1.4", what every tag and doc example uses) and the bare form ("2.1.4", what release binaries carry in ldflags). Comparing them as strings made a config pinned to "v2.1.4" always mismatch a binary reporting "2.1.4" (issue #212), so the prefix is dropped before anything numeric happens.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b string) int

Compare returns -1, 0 or 1 depending on how a compares to b.

func IsValid

func IsValid(version string) bool

IsValid reports whether the version carries a major.minor.patch.

func Parse

func Parse(version string) (major, minor, patch int, ok bool)

Parse splits a version into its numeric parts, ignoring any tag prefix.

func Trim

func Trim(version string) string

Trim drops any tag prefix ("v", "release-") so the numeric part parses whatever prefix the project configured.

Types

This section is empty.

Jump to

Keyboard shortcuts

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