From 73a43f35f5c44e861eeb03353e372942e7e03761 Mon Sep 17 00:00:00 2001 From: Yashpal Choudhary Date: Mon, 25 May 2020 14:03:20 +0530 Subject: [PATCH] Fix kubectl describe output format for empty annotations --- staging/src/k8s.io/kubectl/pkg/describe/describe.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/staging/src/k8s.io/kubectl/pkg/describe/describe.go b/staging/src/k8s.io/kubectl/pkg/describe/describe.go index 876e66ff975..d8357fecf20 100644 --- a/staging/src/k8s.io/kubectl/pkg/describe/describe.go +++ b/staging/src/k8s.io/kubectl/pkg/describe/describe.go @@ -4716,11 +4716,6 @@ var maxAnnotationLen = 140 func printAnnotationsMultiline(w PrefixWriter, title string, annotations map[string]string) { w.Write(LEVEL_0, "%s:\t", title) - if len(annotations) == 0 { - w.WriteLine("") - return - } - // to print labels in the sorted order keys := make([]string, 0, len(annotations)) for key := range annotations { @@ -4729,7 +4724,7 @@ func printAnnotationsMultiline(w PrefixWriter, title string, annotations map[str } keys = append(keys, key) } - if len(annotations) == 0 { + if len(keys) == 0 { w.WriteLine("") return }