🔥
Some checks failed
CI pipeline for ffd-indexer / checks (go test + golangci) (push) Failing after 26s
CI pipeline for ffd-indexer / build binaries + containers (push) Failing after 3s
CI pipeline for ffd-indexer / format (gofmt + nixfmt) (push) Failing after 3s
CI pipeline for ffd-indexer / integration (live scrape + Typesense) (push) Failing after 20s
Some checks failed
CI pipeline for ffd-indexer / checks (go test + golangci) (push) Failing after 26s
CI pipeline for ffd-indexer / build binaries + containers (push) Failing after 3s
CI pipeline for ffd-indexer / format (gofmt + nixfmt) (push) Failing after 3s
CI pipeline for ffd-indexer / integration (live scrape + Typesense) (push) Failing after 20s
This commit is contained in:
parent
bde13e9b68
commit
63c6f4b761
1 changed files with 3319 additions and 184 deletions
45
internal/version/version.go
Normal file
45
internal/version/version.go
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// Package version exposes build-time version and commit information for the
|
||||
// ffd-indexer binaries.
|
||||
//
|
||||
// The values are injected at build time via the Go linker:
|
||||
//
|
||||
// go build -ldflags "-X git.xengi.de/ffd/indexer/internal/version.Version=1.2.3 \
|
||||
// -X git.xengi.de/ffd/indexer/internal/version.Commit=a1b2c3d"
|
||||
//
|
||||
// (the flake sets these from `version` and `shortRev`). When built with a
|
||||
// plain `go build`/`go run` the variables stay empty and the binary reports
|
||||
// itself as the development build.
|
||||
package version
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// Version is the application version, overridden at build time.
|
||||
var Version = ""
|
||||
|
||||
// Commit is the git commit the binary was built from, overridden at build time.
|
||||
var Commit = ""
|
||||
|
||||
// PrintFull writes the canonical multi-line version block to stdout. This is
|
||||
// the human-readable format used by kubectl, docker, kind and friends:
|
||||
//
|
||||
// Version: 1.2.3
|
||||
// Commit: a1b2c3d
|
||||
// Go version: go1.27.1
|
||||
//
|
||||
// Empty values are printed as "dev" so the output is always self-explanatory.
|
||||
func PrintFull() {
|
||||
v := Version
|
||||
if v == "" {
|
||||
v = "dev"
|
||||
}
|
||||
c := Commit
|
||||
if c == "" {
|
||||
c = "dev"
|
||||
}
|
||||
fmt.Printf("Version: %s\n", v)
|
||||
fmt.Printf("Commit: %s\n", c)
|
||||
fmt.Printf("Go version: %s\n", runtime.Version())
|
||||
}
|
||||
Loading…
Reference in a new issue