From e5ed2212a3838b1e64dc7bb6538f6be32b939cf3 Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Sun, 4 Sep 2022 20:14:47 +0800 Subject: [PATCH] cmd/trace: use strings.Builder Change-Id: I690dc517c08be4cd66439baad8b91f16622ff0d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/428292 Reviewed-by: Michael Pratt Run-TryBot: Michael Pratt Auto-Submit: Michael Pratt Reviewed-by: Michael Knyszek TryBot-Result: Gopher Robot --- src/cmd/trace/annotations.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cmd/trace/annotations.go b/src/cmd/trace/annotations.go index 1c0dad56d8..a276d7b642 100644 --- a/src/cmd/trace/annotations.go +++ b/src/cmd/trace/annotations.go @@ -370,7 +370,7 @@ func (task *taskDesc) String() string { if task == nil { return "task " } - wb := new(bytes.Buffer) + wb := new(strings.Builder) fmt.Fprintf(wb, "task %d:\t%s\n", task.id, task.name) fmt.Fprintf(wb, "\tstart: %v end: %v complete: %t\n", task.firstTimestamp(), task.endTimestamp(), task.complete()) fmt.Fprintf(wb, "\t%d goroutines\n", len(task.goroutines)) @@ -872,7 +872,7 @@ func (h *durationHistogram) ToHTML(urlmaker func(min, max time.Duration) string) } } - w := new(bytes.Buffer) + w := new(strings.Builder) fmt.Fprintf(w, ``) for i := h.MinBucket; i <= h.MaxBucket; i++ { // Tick label. @@ -914,7 +914,7 @@ func (h *durationHistogram) String() string { } } - w := new(bytes.Buffer) + w := new(strings.Builder) for i := h.MinBucket; i <= h.MaxBucket; i++ { count := h.Buckets[i] bar := count * barWidth / maxCount