version

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Package version provides semantic version parsing and manipulation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsGreater added in v1.0.0

func IsGreater(a, b string) bool

IsGreater returns true if version a is greater than version b.

Types

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

Version represents a semantic version.

func Parse

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

Parse parses a semantic version string.

func (*Version) Bump

func (v *Version) Bump(bumpType string) (*Version, error)

Bump returns a new version with the specified component bumped.

func (*Version) Compare

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

Compare compares two versions. Returns -1 if v < other, 0 if v == other, 1 if v > other.

func (*Version) String

func (v *Version) String() string

String returns the version as a string.

Jump to

Keyboard shortcuts

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