version

package
v1.0.7 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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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