Report the Go build info version when linker flags set none (closes #422)
check / check (push) Successful in 12m33s

A `go install` of a tag sets no linker flags, so the binary reported
`dev`. Version, commit and commit date that the linker flags leave
unset now come from the build info Go records. Go records a
pseudo-version for an untagged commit and a `+dirty` suffix for a
modified checkout; `IsDevVersion` now counts both as development
builds, using `golang.org/x/mod`.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-11 00:29:48 +00:00
1 parent aae7fa17ae
commit e82aa12f27
5 files changed
+193 -18

No files matched your search

+3
View File
@@ -21,6 +21,8 @@ const shortCommitLen = 12
const exitCodeInterrupted = 130
// Entry is the main entry point for the CLI application.
// It first takes the version, commit and commit date the linker flags
// left unset from the Go build info (see globals.FromBuildInfo).
// It prints the startup banner to stderr (unless a banner-suppressing
// flag is present in os.Args — see bannerSuppressedInArgs), executes the
// root cobra command, and routes any returned error through the
@@ -33,6 +35,7 @@ const exitCodeInterrupted = 130
// deferred profile writers run before the process ends. See run in
// cmd/vaultik/main.go.
func Entry() int {
globals.UseBuildInfo()
emitStartupBanner(os.Args[1:], os.Stderr)
rootCmd := NewRootCommand()