mirror of
https://github.com/Cheviiot/Vintner.git
synced 2026-08-03 15:57:24 +00:00
Show git commit and build time in vintner version
Uses Go's automatic VCS build-info stamping (vcs.revision/vcs.time/ vcs.modified, embedded by `go build` since Go 1.18 - no -ldflags changes needed, works the same for a CI release build and a plain local `go build`). Knowing the exact commit a bug report's binary was built from, not just the X.Y.Z tag, is the point - two builds of the same tag could still differ. Split the pure formatting logic (formatVersion) from the debug.ReadBuildInfo() call so it's actually unit-testable: `go test` binaries don't get VCS stamping the way `go build` ones do, so there was no way to exercise the revision-formatting branch through versionString() itself.
This commit is contained in:
+1
-1
@@ -50,7 +50,7 @@ func runCLI(args []string) int {
|
||||
case "completion":
|
||||
return runCompletion(args[1:])
|
||||
case "version", "v", "--version":
|
||||
fmt.Println("vintner " + version)
|
||||
fmt.Println(versionString())
|
||||
return 0
|
||||
case "-h", "--help", "help", "h":
|
||||
printUsage()
|
||||
|
||||
Reference in New Issue
Block a user