@@ -777,10 +777,11 @@ func describePodIPs(pod *corev1.Pod, w PrefixWriter, space string) {
777
777
}
778
778
779
779
func describeVolumes (volumes []corev1.Volume , w PrefixWriter , space string ) {
780
- if volumes == nil || len (volumes ) == 0 {
780
+ if len (volumes ) == 0 {
781
781
w .Write (LEVEL_0 , "%sVolumes:\t <none>\n " , space )
782
782
return
783
783
}
784
+
784
785
w .Write (LEVEL_0 , "%sVolumes:\n " , space )
785
786
for _ , volume := range volumes {
786
787
nameIndent := ""
@@ -2426,7 +2427,6 @@ func describeIngressTLS(w PrefixWriter, ingTLS []networkingv1beta1.IngressTLS) {
2426
2427
w .Write (LEVEL_1 , "%v terminates %v\n " , t .SecretName , strings .Join (t .Hosts , "," ))
2427
2428
}
2428
2429
}
2429
- return
2430
2430
}
2431
2431
2432
2432
// TODO: Move from annotations into Ingress status.
@@ -2435,7 +2435,6 @@ func describeIngressAnnotations(w PrefixWriter, annotations map[string]string) {
2435
2435
for k , v := range annotations {
2436
2436
w .Write (LEVEL_1 , "%v:\t %s\n " , k , v )
2437
2437
}
2438
- return
2439
2438
}
2440
2439
2441
2440
// ServiceDescriber generates information about a service.
@@ -2742,8 +2741,8 @@ func (d *ServiceAccountDescriber) Describe(namespace, name string, describerSett
2742
2741
2743
2742
for _ , s := range secrets .Items {
2744
2743
if s .Type == corev1 .SecretTypeServiceAccountToken {
2745
- name , _ := s .Annotations [corev1 .ServiceAccountNameKey ]
2746
- uid , _ := s .Annotations [corev1 .ServiceAccountUIDKey ]
2744
+ name := s .Annotations [corev1 .ServiceAccountNameKey ]
2745
+ uid := s .Annotations [corev1 .ServiceAccountUIDKey ]
2747
2746
if name == serviceAccount .Name && uid == string (serviceAccount .UID ) {
2748
2747
tokens = append (tokens , s )
2749
2748
}
@@ -4319,7 +4318,7 @@ func printLabelsMultiline(w PrefixWriter, title string, labels map[string]string
4319
4318
func printLabelsMultilineWithIndent (w PrefixWriter , initialIndent , title , innerIndent string , labels map [string ]string , skip sets.String ) {
4320
4319
w .Write (LEVEL_0 , "%s%s:%s" , initialIndent , title , innerIndent )
4321
4320
4322
- if labels == nil || len (labels ) == 0 {
4321
+ if len (labels ) == 0 {
4323
4322
w .WriteLine ("<none>" )
4324
4323
return
4325
4324
}
@@ -4357,7 +4356,7 @@ func printNodeTaintsMultiline(w PrefixWriter, title string, taints []corev1.Tain
4357
4356
func printTaintsMultilineWithIndent (w PrefixWriter , initialIndent , title , innerIndent string , taints []corev1.Taint ) {
4358
4357
w .Write (LEVEL_0 , "%s%s:%s" , initialIndent , title , innerIndent )
4359
4358
4360
- if taints == nil || len (taints ) == 0 {
4359
+ if len (taints ) == 0 {
4361
4360
w .WriteLine ("<none>" )
4362
4361
return
4363
4362
}
@@ -4388,7 +4387,7 @@ func printPodsMultiline(w PrefixWriter, title string, pods []corev1.Pod) {
4388
4387
func printPodsMultilineWithIndent (w PrefixWriter , initialIndent , title , innerIndent string , pods []corev1.Pod ) {
4389
4388
w .Write (LEVEL_0 , "%s%s:%s" , initialIndent , title , innerIndent )
4390
4389
4391
- if pods == nil || len (pods ) == 0 {
4390
+ if len (pods ) == 0 {
4392
4391
w .WriteLine ("<none>" )
4393
4392
return
4394
4393
}
@@ -4419,7 +4418,7 @@ func printPodTolerationsMultiline(w PrefixWriter, title string, tolerations []co
4419
4418
func printTolerationsMultilineWithIndent (w PrefixWriter , initialIndent , title , innerIndent string , tolerations []corev1.Toleration ) {
4420
4419
w .Write (LEVEL_0 , "%s%s:%s" , initialIndent , title , innerIndent )
4421
4420
4422
- if tolerations == nil || len (tolerations ) == 0 {
4421
+ if len (tolerations ) == 0 {
4423
4422
w .WriteLine ("<none>" )
4424
4423
return
4425
4424
}
0 commit comments