version

package
v0.80.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package version exposes build metadata (git commit, build time, version). The values are injected at build time via -ldflags "-X ...":

go build -ldflags "\
  -X github.com/lgldsilva/jackui/internal/version.Commit=$(git rev-parse HEAD) \
  -X github.com/lgldsilva/jackui/internal/version.BuildTime=$(date +%s) \
  -X github.com/lgldsilva/jackui/internal/version.Version=$(git describe --tags --always)"

Without ldflags (e.g. `go run` in dev) they keep the defaults below, so the /status endpoint still answers — it just reports "dev"/"unknown".

Index

Constants

This section is empty.

Variables

View Source
var (
	// Commit is the full git SHA the binary was built from.
	Commit = "unknown"
	// BuildTime is the build instant. Accepts a unix epoch (what the Docker
	// BUILD_TIMESTAMP arg carries) or an RFC3339 string; Info() normalises it.
	BuildTime = "unknown"
	// Version is a human tag (e.g. `git describe --tags --always`).
	Version = "dev"
)

Injected via -ldflags. Defaults cover local `go run`/`go test` (no ldflags).

Functions

This section is empty.

Types

type Info

type Info struct {
	Version   string `json:"version"`
	Commit    string `json:"commit"`
	BuildTime string `json:"buildTime"`
	GoVersion string `json:"goVersion"`
}

Info is the build metadata served by GET /status.

func Get

func Get() Info

Get returns the build metadata with BuildTime normalised to RFC3339 when it was injected as a unix epoch (the Dockerfile passes `date +%s`).

Jump to

Keyboard shortcuts

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