version

package
v0.0.0-...-159d35f Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean(ver string) string

Clean returns version without a prefixed v if it exists

Types

type Info

type Info struct {
	GitVersion string `json:"gitVersion"`
	GitCommit  string `json:"gitCommit"`
	BuildDate  string `json:"buildDate"`
	GoVersion  string `json:"goVersion"`
	Compiler   string `json:"compiler"`
	Platform   string `json:"platform"`
}

Info contains versioning information.

func Get

func Get() Info

Get returns the overall codebase version. It's for detecting what code a binary was built from.

func (Info) String

func (info Info) String() string

String returns info as a human-friendly version string.

type Version

type Version struct {
	*semver.Version
}

Version is an extension of semver.Version

func FromGithubVersion

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

FromGithubVersion provides a version parsed from github semver which starts with "v". v1.5.2 provides a sem version of 1.5.2

func FromSemVer

func FromSemVer(v *semver.Version) *Version

FromSemVer converts a semver.Version to our Version

func MustParse

func MustParse(v string) *Version

MustParse parses a given version and panics on error.

func New

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

New provides an instance of Version from a semver string

func (*Version) CompareMajorMinor

func (v *Version) CompareMajorMinor(o *Version) int

CompareMajorMinor provides Compare results -1, 0, 1 for only the major and minor element of the semver, ignoring the patch or prerelease elements. This is useful if you are looking for minVersion for example 1.15.6 is version 1.15 or higher.

Jump to

Keyboard shortcuts

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