version

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseVersionControlURL string = "https://github.com/janpfeifer/gonb"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type VersionInfo

type VersionInfo struct {
	Version     string
	Commit      string
	CommitLink  string
	ReleaseLink string
}

func AppVersion

func AppVersion(version, gitVersion, gitHash string) *VersionInfo

AppVersion determines version and commit information based on multiple data sources:

  • AppVersion information dynamically added by `git archive` in the remaining to parameters.
  • A hardcoded version number passed as first parameter.
  • Commit information added to the binary by `go build`.

It's supposed to be called like this in combination with setting the `export-subst` attribute for the corresponding file in .gitattributes:

var AppVersion = version.AppVersion("1.0.0-rc1", "$Format:%(describe)$", "$Format:%H$")

When exported using `git archive`, the placeholders are replaced in the file and this version information is preferred. Otherwise the hardcoded version is used and augmented with commit information from the build metadata.

Source: https://github.com/Icinga/icingadb/blob/51068fff46364385f3c0165aab7b7393fa6a303b/pkg/version/version.go

func (*VersionInfo) GetInfo

func (v *VersionInfo) GetInfo() VersionInfo

GetInfo Get version info

func (*VersionInfo) Markdown

func (v *VersionInfo) Markdown() string

func (*VersionInfo) Print

func (v *VersionInfo) Print()

Print writes verbose version output to stdout.

func (*VersionInfo) String

func (v *VersionInfo) String() string

String Get version as a string

Jump to

Keyboard shortcuts

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