semver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package semver provides semantic versioning functionality for Shipyard. It implements parsing, comparison, and manipulation of semantic versions according to the Semantic Versioning specification (https://semver.org/).

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 components

func MustParse

func MustParse(versionStr string) *Version

MustParse parses a version string and panics if it's invalid

func New

func New(major, minor, patch int) *Version

New creates a new Version with the given major, minor, and patch values

func Parse

func Parse(versionStr string) (*Version, error)

Parse parses a version string into a Version struct

func Zero

func Zero() *Version

Zero returns a zero version (0.0.0)

func (*Version) BumpMajor

func (v *Version) BumpMajor() *Version

BumpMajor increments the major version and resets minor and patch to 0

func (*Version) BumpMinor

func (v *Version) BumpMinor() *Version

BumpMinor increments the minor version and resets patch to 0

func (*Version) BumpPatch

func (v *Version) BumpPatch() *Version

BumpPatch increments the patch version

func (*Version) Compare

func (v *Version) Compare(other *Version) int

Compare compares this version with another version. Returns:

-1 if this version is less than the other
 0 if this version equals the other
 1 if this version is greater than the other

func (*Version) Copy

func (v *Version) Copy() *Version

Copy returns a copy of this version

func (*Version) Equals

func (v *Version) Equals(other *Version) bool

Equals returns true if this version equals the other version

func (*Version) GreaterThan

func (v *Version) GreaterThan(other *Version) bool

GreaterThan returns true if this version is greater than the other version

func (*Version) LessThan

func (v *Version) LessThan(other *Version) bool

LessThan returns true if this version is less than the other version

func (*Version) String

func (v *Version) String() string

String returns the version as a string in the format "major.minor.patch"

Jump to

Keyboard shortcuts

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