buildinfo

package
v0.48.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 8 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 Info added in v0.21.0

type Info struct {
	Version   string    `json:"version" yaml:"version"`
	Commit    string    `json:"commit,omitempty" yaml:"commit,omitempty"`
	Timestamp time.Time `json:"timestamp,omitempty" yaml:"timestamp,omitempty"`
}

Info encapsulates Version, Commit and Timestamp.

func Get added in v0.39.0

func Get() Info

Get returns Info. If buildinfo.Timestamp cannot be parsed, the returned Info.Timestamp will be the zero value.

func (Info) LogValue added in v0.47.0

func (bi Info) LogValue() slog.Value

LogValue implements slog.LogValuer.

func (Info) ShortCommit added in v0.47.0

func (bi Info) ShortCommit() string

ShortCommit returns the short commit hash.

func (Info) String added in v0.47.0

func (bi Info) String() string

String returns a string representation of Info.

func (Info) UserAgent added in v0.47.0

func (bi Info) UserAgent() string

UserAgent returns a string suitable for use in an HTTP User-Agent header.

Jump to

Keyboard shortcuts

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