version

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValid

func IsValid(v string) bool

IsValid checks if a version string is valid according to semantic versioning It requires exactly major.minor.patch and handles v-prefixed versions

Types

type Version

type Version struct {
	Major      int
	Minor      int
	Patch      int
	PreRelease string
	Build      string
}

Version represents a semantic version (SemVer)

func Parse

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

Parse parses a version string into a Version struct

func (*Version) Compare

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

Compare compares this version to another version. Returns -1 if v < other, 0 if v == other, or 1 if v > other.

func (*Version) Satisfies

func (v *Version) Satisfies(constraint string) (bool, error)

Satisfies checks if this version satisfies the given constraint

func (*Version) String

func (v *Version) String() string

String returns the string representation of the version

Jump to

Keyboard shortcuts

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