version

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean added in v0.7.0

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 added in v0.7.0

type Version struct {
	*semver.Version
}

Version is an extension of semver.Version

func FromGithubVersion added in v0.7.0

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 added in v0.7.0

func FromSemVer(v *semver.Version) *Version

FromSemVer converts a semver.Version to our Version

func MustParse added in v0.7.0

func MustParse(v string) *Version

MustParse parses a given version and panics on error.

func New added in v0.7.0

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

New provides an instance of Version from a semver string

func (*Version) CompareMajorMinor added in v0.7.0

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