version

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const PRE = "devel"

PRE is the default pre-release identifier for development versions.

Variables

View Source
var Error = errors.New("version")

Error represents a versioning error.

Functions

func Compare added in v0.4.0

func Compare(v Version, w Version) int

Compare returns an integer comparing two versions according to semantic version precedence. The result will be 0 if v == w, -1 if v < w, or +1 if v > w.

func IsDev

func IsDev(v string) bool

IsDev checks if the version is a development version.

func IsValid added in v0.4.0

func IsValid(v string) bool

func Prerelease

func Prerelease(v string) string

Prerelease extracts the pre-release part of a semantic version.

Types

type Setting added in v0.4.1

type Setting Version

func (*Setting) MarshalSetting added in v0.4.1

func (s *Setting) MarshalSetting() ([]byte, error)

MarshalSetting converts the String setting to a byte slice for storage or transmission.

func (Setting) String added in v0.4.1

func (s Setting) String() string

Stringer implementation for String type

func (*Setting) UnmarshalSetting added in v0.4.1

func (s *Setting) UnmarshalSetting(data []byte) error

UnmarshalSetting updates the String setting from a byte slice, typically read from storage or received in a message.

type Version

type Version string

Version is a semantic version string.

func Current

func Current() Version

Current attempts to generate the closest realistic semantic version without requiring -ldflags, using Go module build info and Git fallbacks.

func OfDir added in v0.4.1

func OfDir(dir string) Version

func Parse

func Parse(v string) (Version, error)

Parse attempts to parse a version string and returns a valid `Version` type.

func (Version) Build

func (v Version) Build() string

Build returns the build metadata of the version, if any.

func (Version) IsValid added in v0.4.1

func (v Version) IsValid() bool

func (Version) String

func (v Version) String() string

String returns the string representation of the version.

func (*Version) UnmarshalJSON added in v0.4.1

func (v *Version) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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