Skip to content

Commit 8e2d4f0

Browse files
nolanemirotemirot
authored andcommitted
perf: better string concatenation
Signed-off-by: emirot <emirot.nolan@gmail.com>
1 parent aec32a5 commit 8e2d4f0

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

pkg/util/kube/pod.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ func ToSystemAffinity(loadAffinity *LoadAffinity, volumeTopology *corev1api.Node
274274

275275
func DiagnosePod(pod *corev1api.Pod, events *corev1api.EventList) string {
276276
var diag strings.Builder
277-
diag.WriteString(fmt.Sprintf("Pod %s/%s, phase %s, node name %s, message %s\n", pod.Namespace, pod.Name, pod.Status.Phase, pod.Spec.NodeName, pod.Status.Message))
277+
_, _ = 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 {
280280
diag.WriteString(fmt.Sprintf("Pod condition %s, status %s, reason %s, message %s\n", condition.Type, condition.Status, condition.Reason, condition.Message))

pkg/util/kube/pvc_pv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ func GetPVCForPodVolume(vol *corev1api.Volume, pod *corev1api.Pod, crClient crcl
465465

466466
func DiagnosePVC(pvc *corev1api.PersistentVolumeClaim, events *corev1api.EventList) string {
467467
var diag strings.Builder
468-
diag.WriteString(fmt.Sprintf("PVC %s/%s, phase %s, binding to %s\n", pvc.Namespace, pvc.Name, pvc.Status.Phase, pvc.Spec.VolumeName))
468+
_, _ = fmt.Fprintf(&diag, "PVC %s/%s, phase %s, binding to %s\n", pvc.Namespace, pvc.Name, pvc.Status.Phase, pvc.Spec.VolumeName)
469469

470470
if events != nil {
471471
for _, e := range events.Items {

0 commit comments

Comments
 (0)