From 22e61ef06f207abac5c6122eeba846d84b5d7b8b Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sat, 30 Sep 2023 06:53:00 +0200 Subject: [PATCH] inspect: do not display platforms field if empty Signed-off-by: CrazyMax --- commands/inspect.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/commands/inspect.go b/commands/inspect.go index 1e1f313a083..6a2b71a2618 100644 --- a/commands/inspect.go +++ b/commands/inspect.go @@ -93,7 +93,10 @@ func runInspect(dockerCli command.Cli, in inspectOptions) error { if nodes[i].Version != "" { fmt.Fprintf(w, "Buildkit:\t%s\n", nodes[i].Version) } - fmt.Fprintf(w, "Platforms:\t%s\n", strings.Join(platformutil.FormatInGroups(n.Node.Platforms, n.Platforms), ", ")) + platforms := platformutil.FormatInGroups(n.Node.Platforms, n.Platforms) + if len(platforms) > 0 { + fmt.Fprintf(w, "Platforms:\t%s\n", strings.Join(platforms, ", ")) + } if debug.IsEnabled() { fmt.Fprintf(w, "Features:\n") features := nodes[i].Driver.Features(ctx)