Skip to content

Commit ae84800

Browse files
committed
perf: better string concatenation
1 parent 8305c83 commit ae84800

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

pkg/util/csi/volume_snapshot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ func DiagnoseVS(vs *snapshotv1api.VolumeSnapshot, events *corev1api.EventList) s
714714
if events != nil {
715715
for _, e := range events.Items {
716716
if e.InvolvedObject.UID == vs.UID && e.Type == corev1api.EventTypeWarning {
717-
diag.WriteString(fmt.Sprintf("VS event reason %s, message %s\n", e.Reason, e.Message))
717+
_, _ = fmt.Fprintf(&diag, "VS event reason %s, message %s\n", e.Reason, e.Message)
718718
}
719719
}
720720
}

pkg/util/kube/pod.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,13 @@ func DiagnosePod(pod *corev1api.Pod, events *corev1api.EventList) string {
277277
_, _ = fmt.Fprintf(&diag, "Pod %s/%s, phase %s, node name %s, message %s\n", pod.Namespace, pod.Name, pod.Status.Phase, pod.Spec.NodeName, pod.Status.Message)
278278

279279
for _, condition := range pod.Status.Conditions {
280-
diag.WriteString(fmt.Sprintf("Pod condition %s, status %s, reason %s, message %s\n", condition.Type, condition.Status, condition.Reason, condition.Message))
280+
_, _ = fmt.Fprintf(&diag, "Pod condition %s, status %s, reason %s, message %s\n", condition.Type, condition.Status, condition.Reason, condition.Message)
281281
}
282282

283283
if events != nil {
284284
for _, e := range events.Items {
285285
if e.InvolvedObject.UID == pod.UID && e.Type == corev1api.EventTypeWarning {
286-
diag.WriteString(fmt.Sprintf("Pod event reason %s, message %s\n", e.Reason, e.Message))
286+
_, _ = fmt.Fprintf(&diag, "Pod event reason %s, message %s\n", e.Reason, e.Message)
287287
}
288288
}
289289
}

pkg/util/kube/pvc_pv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ func DiagnosePVC(pvc *corev1api.PersistentVolumeClaim, events *corev1api.EventLi
470470
if events != nil {
471471
for _, e := range events.Items {
472472
if e.InvolvedObject.UID == pvc.UID && e.Type == corev1api.EventTypeWarning {
473-
diag.WriteString(fmt.Sprintf("PVC event reason %s, message %s\n", e.Reason, e.Message))
473+
_, _ = fmt.Fprintf(&diag, "PVC event reason %s, message %s\n", e.Reason, e.Message)
474474
}
475475
}
476476
}

0 commit comments

Comments
 (0)