From 80640bca72371ea66f7972d0ecfe8862ef683a85 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 10 Apr 2023 02:11:17 +0200 Subject: [PATCH] cli/command/system: make default version template a const Signed-off-by: Sebastiaan van Stijn --- cli/command/system/version.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/command/system/version.go b/cli/command/system/version.go index 3ead03215c..c0dd17bba6 100644 --- a/cli/command/system/version.go +++ b/cli/command/system/version.go @@ -20,7 +20,7 @@ import ( "github.com/tonistiigi/go-rosetta" ) -var versionTemplate = `{{with .Client -}} +const defaultVersionTemplate = `{{with .Client -}} Client:{{if ne .Platform.Name ""}} {{.Platform.Name}}{{end}} Version: {{.Version}} API version: {{.APIVersion}}{{if ne .APIVersion .DefaultAPIVersion}} (downgraded from {{.DefaultAPIVersion}}){{end}} @@ -195,7 +195,7 @@ func prettyPrintVersion(dockerCli command.Cli, vd versionInfo, tmpl *template.Te func newVersionTemplate(templateFormat string) (*template.Template, error) { if templateFormat == "" { - templateFormat = versionTemplate + templateFormat = defaultVersionTemplate } tmpl := templates.New("version").Funcs(template.FuncMap{"getDetailsOrder": getDetailsOrder}) tmpl, err := tmpl.Parse(templateFormat)