show version with branch and commit in help and -version

- add -version flag (besides --version and -V)
- help output includes the version
- commit and branch are set via ldflags by goreleaser; plain go build
  falls back to the VCS revision embedded by Go

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Florian WaltherandClaude Opus 5.5 committed 2026-10-03 19:38:48 +02:00
1 parent 03e791cbcd
commit f51680f83c
4 files changed
+79 -7

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ builds:
flags:
- -trimpath
ldflags:
- -s -w -X main.version={{ .Version }}
- -s -w -X main.version={{ .Version }} -X main.commit={{ .ShortCommit }} -X main.branch={{ .Branch }}
goos:
- linux
- darwin