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 <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2022-03-15 18:48:32 +01:00
parent fa0d3c564a
commit 45df70ec1e

View File

@ -89,9 +89,7 @@ Client:\tPodman Engine
Version:\t{{.Version}} Version:\t{{.Version}}
API Version:\t{{.APIVersion}} API Version:\t{{.APIVersion}}
Go Version:\t{{.GoVersion}} Go Version:\t{{.GoVersion}}
{{if .GitCommit -}} {{if .GitCommit -}}Git Commit:\t{{.GitCommit}}\n{{end -}}
Git Commit:\t{{.GitCommit}}
{{- end}}
Built:\t{{.BuiltTime}} Built:\t{{.BuiltTime}}
OS/Arch:\t{{.OsArch}} OS/Arch:\t{{.OsArch}}
{{- end}} {{- end}}
@ -102,9 +100,7 @@ Server:\tPodman Engine
Version:\t{{.Version}} Version:\t{{.Version}}
API Version:\t{{.APIVersion}} API Version:\t{{.APIVersion}}
Go Version:\t{{.GoVersion}} Go Version:\t{{.GoVersion}}
{{if .GitCommit -}} {{if .GitCommit -}}Git Commit:\t{{.GitCommit}}\n{{end -}}
Git Commit:\t{{.GitCommit}}
{{- end}}
Built:\t{{.BuiltTime}} Built:\t{{.BuiltTime}}
OS/Arch:\t{{.OsArch}} OS/Arch:\t{{.OsArch}}
{{- end}}{{- end}} {{- end}}{{- end}}