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:
1 parent
03e791cbcd
commit
f51680f83c
4 files changed
+79
-7
No files matched your search
+1
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user