version

package
v3.4.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// GitCommit contains the git commit of this version.
	GitCommit = ""

	// Appendix is appended after a hypen to the version string.
	Appendix = ""
)

The GitCommit and Appendix variable are set via the go linker (go build -ldflags -X [...]).

View Source
var CurSemVer = SemVer{}

CurSemVer is the current version

Functions

func LoadPackageVars

func LoadPackageVars() error

LoadPackageVars parses the rawVersion, GitCommit and Appendix package variables and initializes CurSemVer accordingly.

Types

type SemVer

type SemVer struct {
	Major     int
	Minor     int
	Patch     int
	Appendix  string
	GitCommit string
}

SemVer represents a semantic version number.

func New

func New(ver string) (*SemVer, error)

New returns a Semver that is initialized by parsing it from a string.

func (*SemVer) Short

func (s *SemVer) Short() string

Short returns the version in MAJOR.MINOR.PATCH-APPENDIX format.

func (*SemVer) String

func (s *SemVer) String() string

String returns the version in MAJOR.MINOR.PATCH-APPENDIX (GITCOMMIT) format. If GitCommit is empty, the part is omitted.

Jump to

Keyboard shortcuts

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