version

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAJOR string = "major"
	MINOR string = "minor"
	PATCH string = "patch"
)

Variables

View Source
var ErrInvalidIncrement = errors.New("invalid version incrementation, must be one of [major|minor|patch]")
View Source
var ErrInvalidVersion = errors.New("not a valid semantic version")

Functions

func IsSemVer

func IsSemVer(s string) bool

Check if a given string is a valid semantic version (e.g. 0.1.0)

  • No Letters, just positive Numbers
  • 3 Components (Numbers) separated with '.'

Types

type Version

type Version struct {
	Major uint64
	Minor uint64
	Patch uint64
}

A Semantic Version struct, where only positive integers are allowed

func NewVersion

func NewVersion() Version

Create a new Version struct with all Fields set to Zero

func ParseVersion

func ParseVersion(s string) (Version, error)

Parse a string into a Version Struct

func (*Version) Bump

func (v *Version) Bump(increment string) error

Bump the Version by the given increment (major, minor, patch) Returns an ErrInvalidIncrement if the wrong increment is used.

func (Version) String

func (v Version) String() string

Jump to

Keyboard shortcuts

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