version

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package version exposes the build-time metadata of the tyche binary.

The values are set via -ldflags="-X" at link time. The defaults (used during `go run` or `go test`) are "dev" for the version and the current commit is empty; the Makefile or release pipeline populates them.

Example:

go build -ldflags "\
    -X github.com/webdeveloperben/tyche/internal/version.Version=1.2.3 \
    -X github.com/webdeveloperben/tyche/internal/version.Commit=$(git rev-parse HEAD) \
    -X github.com/webdeveloperben/tyche/internal/version.Date=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
    -X github.com/webdeveloperben/tyche/internal/version.BuiltBy=release-please" \
    -o ./bin/tyche ./cmd/tyche

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "dev"
	Commit  = ""
	Date    = ""
	BuiltBy = "source"
)

These variables are overridden at link time. The defaults let `go run` and `go test ./...` produce a usable `tyche version` output without flags.

Functions

func String

func String() string

String returns a one-line, human-readable summary of the build identity. This is what `tyche version` prints to stdout.

Types

type Info

type Info struct {
	Version string `json:"version"`
	Commit  string `json:"commit,omitempty"`
	Date    string `json:"date,omitempty"`
	BuiltBy string `json:"built_by,omitempty"`
	Go      string `json:"go"`
}

Info is the rendered, one-line build identity of the binary.

func Get

func Get() Info

Get returns the binary's build identity. The Go field is always populated from runtime.Version; everything else comes from ldflags, falling back to build-info derivation from runtime/debug when ldflags are absent.

Jump to

Keyboard shortcuts

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