From 45df70ec1e92e6f23ad7f7ef5214ea2181f7bcb1 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 15 Mar 2022 18:48:32 +0100 Subject: fix empty newline in version output When podman is build without git commit information it will print a empty newline instead. This is undesirable and a regression introduced in commit 7d22cc88ef38. To test build podman with `go build -mod=vendor -o bin/podman ./cmd/podman` and check the output of bin/podman version with and without this commit. [NO NEW TESTS NEEDED] Signed-off-by: Paul Holzinger --- cmd/podman/system/version.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cmd/podman/system/version.go b/cmd/podman/system/version.go index 6239482b5..9fb4a966a 100644 --- a/cmd/podman/system/version.go +++ b/cmd/podman/system/version.go @@ -89,9 +89,7 @@ Client:\tPodman Engine Version:\t{{.Version}} API Version:\t{{.APIVersion}} Go Version:\t{{.GoVersion}} -{{if .GitCommit -}} - Git Commit:\t{{.GitCommit}} -{{- end}} +{{if .GitCommit -}}Git Commit:\t{{.GitCommit}}\n{{end -}} Built:\t{{.BuiltTime}} OS/Arch:\t{{.OsArch}} {{- end}} @@ -102,9 +100,7 @@ Server:\tPodman Engine Version:\t{{.Version}} API Version:\t{{.APIVersion}} Go Version:\t{{.GoVersion}} -{{if .GitCommit -}} - Git Commit:\t{{.GitCommit}} -{{- end}} +{{if .GitCommit -}}Git Commit:\t{{.GitCommit}}\n{{end -}} Built:\t{{.BuiltTime}} OS/Arch:\t{{.OsArch}} {{- end}}{{- end}} -- cgit v1.2.3-54-g00ecf