buildinfo

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package buildinfo hosts build info variables populated via ldflags.

For testing, you can override the build version using envar SQ_BUILD_VERSION (panics if not a valid semver).

Index

Constants

View Source
const DefaultVersion = "v0.0.0-dev"

DefaultVersion is the default value for Version if not set via ldflags.

View Source
const EnvOverrideVersion = `SQ_BUILD_VERSION`

EnvOverrideVersion is used for testing build version, e.g. for config upgrades.

Variables

View Source
var (
	// Version is the build version. If not set at build time via
	// ldflags, Version takes the value of DefaultVersion.
	Version = DefaultVersion

	// Commit is the commit hash.
	Commit string

	// Timestamp is the timestamp of when the cli was built.
	Timestamp string
)

Functions

func IsDefaultVersion added in v0.21.0

func IsDefaultVersion() bool

IsDefaultVersion returns true if Version is empty or DefaultVersion.

Types

type BuildInfo added in v0.21.0

type BuildInfo struct {
	Version   string `json:"version" yaml:"version"`
	Commit    string `json:"commit,omitempty" yaml:"commit,omitempty"`
	Timestamp string `json:"timestamp,omitempty" yaml:"timestamp,omitempty"`
}

BuildInfo encapsulates Version, Commit and Timestamp.

func Get added in v0.39.0

func Get() BuildInfo

Get returns BuildInfo.

func (BuildInfo) LogValue added in v0.31.0

func (bi BuildInfo) LogValue() slog.Value

LogValue implements slog.LogValuer.

func (BuildInfo) String added in v0.21.0

func (bi BuildInfo) String() string

String returns a string representation of BuildInfo.

Jump to

Keyboard shortcuts

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