version

package
v0.6.20 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	EnvDefaultMono = "GDENV_DEFAULT_MONO"

	Prefix                     = "v"
	SeparatorBuildMetadata     = "+" // https://semver.org/#spec-item-10
	SeparatorPreReleaseVersion = "-" // https://semver.org/#spec-item-9

	LabelMono   = LabelStable + "_" + Mono
	LabelStable = "stable"
	Mono        = "mono"
)

Variables

View Source
var (
	ErrInvalid       = errors.New("invalid version")
	ErrInvalidNumber = errors.New("invalid version number")
	ErrMissing       = errors.New("missing version")
	ErrUnrecognized  = errors.New("unrecognized version")
	ErrUnsupported   = errors.New("unsupported version")
)

Functions

func LabelDefault

func LabelDefault() string

Returns the default version label. Set 'GDENV_DEFAULT_MONO' to a boolean value to switch between 'stable' and 'stable_mono' default version labels.

func Validate

func Validate(v Version) error

Validate verifies that a 'Version' is valid by checking that parsing its stringified representation produces the identical 'Version' struct.

Types

type Version

type Version struct {
	// contains filtered or unexported fields
}

A struct containing a Godot version specification.

func Godot3

func Godot3() Version

Returns a 'Version' struct for Godot v3.

func Godot4

func Godot4() Version

Returns a 'Version' struct for Godot v4.

func MustParse

func MustParse(input string) Version

Parses a 'Version' struct from a semantic version string or panics if it would fail.

func Parse

func Parse(input string) (Version, error)

Parses a 'Version' struct from a semantic version string.

func (Version) CompareNormal

func (v Version) CompareNormal(w Version) int

Compares the "normal version" (see https://semver.org/#spec-item-2) to another 'Version' struct. The result will be '0' if 'v' == 'w', '-1' if 'v' < 'w', or '+1' if 'v' > 'w'.

func (Version) IsMono

func (v Version) IsMono() bool

Returns whether the version specifies a "mono" release (i.e. 'stable_mono').

func (Version) IsStable

func (v Version) IsStable() bool

Returns whether the version specifies a "stable" release (e.g. 'stable' or 'stable_mono').

func (Version) Label

func (v Version) Label() string

Returns the version label or a default if not defined.

func (Version) Major

func (v Version) Major() int

Returns the major version component (see https://semver.org/#spec-item-4).

func (Version) Minor

func (v Version) Minor() int

Returns the minor version component (see https://semver.org/#spec-item-7).

func (Version) Normal

func (v Version) Normal() string

Returns the "normal version" format of the 'Version' (see https://semver.org/#spec-item-2).

func (Version) Patch

func (v Version) Patch() int

Returns the patch version component (see https://semver.org/#spec-item-6).

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