version

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// GitCommit is the git commit that was compiled. This will be filled in by the compiler
	// in the Makefile from Git short SHA-1 of HEAD commit.
	GitCommit string

	// Build is the Jenkins build that compiled this version. This will be filled
	// in by the compiler in the Makefile from Jenkins build.
	Build string

	// Version is the main version number that is being run at the moment. This will be
	// filled in by the compiler in the Makefile from latest.go
	Version string

	// Prerelease is a pre-release marker for the version. If this is "" (empty string)
	// then it means that it is a final release. Otherwise, this is a pre-release
	// such as "dev" (in development), "beta", "rc1", etc.
	Prerelease string

	// AppName is the application name to show with the version. It may be empty
	// but looks good to have a name.
	AppName = "KubeKit"
)

Functions

func Compare

func Compare(version1, version2 string) (int, error)

Compare compares two version in string form

func LongPrintln

func LongPrintln()

LongPrintln prints the version long format using the output of LongString()

func LongString

func LongString() string

LongString return the version in a long format that includes the build number and git commit SHA

func Println

func Println()

Println prints the version using the output of String()

func String

func String() string

String return the version as it will be show in the terminal

Types

type SemVer

type SemVer struct {
	Major  int
	Minor  int
	Patch  int
	Labels []string
	// contains filtered or unexported fields
}

SemVer is a struct to store a version and do some functions on it

func NewSemVer

func NewSemVer(version string) (*SemVer, error)

NewSemVer creates a SemVer from a version in form of string

func (*SemVer) Compare

func (v *SemVer) Compare(ver *SemVer) int

Compare compares two versions in form of SemVer. Rules are: v > ver : 1 v < ver : -1 v == ver : 0

func (*SemVer) Diff

func (v *SemVer) Diff(ver *SemVer) *SemVer

Diff returns the difference between two versions

func (*SemVer) EQ

func (v *SemVer) EQ(ver *SemVer) bool

EQ returns true if the given version is equal to this version

func (*SemVer) GE

func (v *SemVer) GE(ver *SemVer) bool

GE returns true if the given version is greater than or equal to this version

func (*SemVer) GT

func (v *SemVer) GT(ver *SemVer) bool

GT returns true if the given version is greater than this version

func (*SemVer) In

func (v *SemVer) In(min, max *SemVer) bool

In returns true if the given version is in the given range

func (*SemVer) LE

func (v *SemVer) LE(ver *SemVer) bool

LE returns true if the given version is less than or equal to this version

func (*SemVer) LT

func (v *SemVer) LT(ver *SemVer) bool

LT returns true if the given version is less than this version

func (*SemVer) NE

func (v *SemVer) NE(ver *SemVer) bool

NE returns true if the given version is equal to this version

func (*SemVer) String

func (v *SemVer) String() string

Jump to

Keyboard shortcuts

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