buildinfo

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package buildinfo resolves the git revision and dirty state of the running binary: from Go's embedded VCS stamps when available, otherwise from ldflags-injected variables or environment variables.

Index

Constants

This section is empty.

Variables

View Source
var (
	Revision  string
	DirtyFlag string
)

Injectable via:

go build -ldflags "-X github.com/ekusiadadus/isutools/buildinfo.Revision=$(git rev-parse HEAD) \
                   -X github.com/ekusiadadus/isutools/buildinfo.DirtyFlag=$(test -n "$(git status --porcelain)" && echo dirty)"

Functions

This section is empty.

Types

type Info

type Info struct {
	Revision string `json:"revision"`
	Dirty    bool   `json:"dirty"`
	Source   string `json:"source"` // vcs | ldflags | env | unknown
}

Info describes the resolved build revision.

func Get

func Get() Info

Get resolves the revision with precedence: embedded VCS stamp, ldflags variables, environment variables.

func (Info) Short

func (i Info) Short() string

Short renders the revision as "f4fdb31" or "f4fdb31 (dirty)".

Jump to

Keyboard shortcuts

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