Summary
optiqor --version prints only the version string. The roadmap (Tier 3, todo.md) calls for --version --verbose to also surface commit SHA, build date, Go version, and target platform. This information is essential for reproducible bug reports and CI pipelines that pin exact builds.
What to do
- Add three
ldflags-injectable package-level variables in cmd/optiqor/main.go:
var (
version = "dev"
commit = "none"
buildDate = "unknown"
)
- Inject them in
.goreleaser.yaml:
ldflags:
- -s -w
- -X main.version={{.Version}}
- -X main.commit={{.ShortCommit}}
- -X main.buildDate={{.Date}}
Update the Makefile build target to pass the same flags via go build -ldflags.
- Wire
rootCmd.Version = version.
optiqor --version --verbose should print:
optiqor v0.1.0
commit: abc1234
built: 2026-05-01T00:00:00Z
go version: go1.24.0
os/arch: darwin/arm64
- Plain
optiqor --version must still print a single line (no regression).
Acceptance criteria
optiqor --version still emits a single line.
optiqor --version --verbose emits the extended block shown above.
go build without ldflags shows dev / none / unknown (graceful fallback).
make lint test passes.
Notes
Only cmd/optiqor/main.go, .goreleaser.yaml, and the Makefile need changes. No new dependencies.
Summary
optiqor --versionprints only the version string. The roadmap (Tier 3,todo.md) calls for--version --verboseto also surface commit SHA, build date, Go version, and target platform. This information is essential for reproducible bug reports and CI pipelines that pin exact builds.What to do
ldflags-injectable package-level variables incmd/optiqor/main.go:.goreleaser.yaml:Makefilebuildtarget to pass the same flags viago build -ldflags.rootCmd.Version = version.optiqor --version --verboseshould print:optiqor --versionmust still print a single line (no regression).Acceptance criteria
optiqor --versionstill emits a single line.optiqor --version --verboseemits the extended block shown above.go buildwithout ldflags showsdev/none/unknown(graceful fallback).make lint testpasses.Notes
Only
cmd/optiqor/main.go,.goreleaser.yaml, and theMakefileneed changes. No new dependencies.