semver

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

Version represents a semantic version with major, minor, and patch numbers

func MustParse

func MustParse(s string) Version

MustParse parses a version string and panics if it fails Use only in tests or when the version string is known to be valid

func Parse

func Parse(s string) (Version, error)

Parse parses a semantic version string into a Version struct Accepts formats: "1.2.3" or "v1.2.3"

func (Version) Bump added in v0.2.0

func (v Version) Bump(changeType string) (Version, error)

Bump returns a new version with the specified change type applied changeType should be one of: "patch", "minor", "major"

func (Version) Compare

func (v Version) Compare(other Version) int

Compare compares this version with another version Returns: -1 if v < other, 0 if v == other, 1 if v > other

func (Version) String

func (v Version) String() string

String returns the string representation of the version (e.g., "1.2.3")

Jump to

Keyboard shortcuts

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