From e761ea071bbd84ca02fa8880e20b072a2d4c1da1 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Thu, 4 Dec 2025 11:20:24 +0100 Subject: [PATCH] Use strings.Builder instead of looped string concatenation. --- stats_prometheus_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stats_prometheus_test.go b/stats_prometheus_test.go index 0516de9..abe83d7 100644 --- a/stats_prometheus_test.go +++ b/stats_prometheus_test.go @@ -77,18 +77,18 @@ func checkStatsValue(t *testing.T, collector prometheus.Collector, value float64 pc = pc[:n] frames := runtime.CallersFrames(pc) - stack := "" + var stack strings.Builder for { frame, more := frames.Next() if !strings.Contains(frame.File, "nextcloud-spreed-signaling") { break } - stack += fmt.Sprintf("%s:%d\n", frame.File, frame.Line) + fmt.Fprintf(&stack, "%s:%d\n", frame.File, frame.Line) if !more { break } } - assert.EqualValues(value, v, "Unexpected value for %s at\n%s", desc, stack) + assert.EqualValues(value, v, "Unexpected value for %s at\n%s", desc, stack.String()) } }