aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorcuiweixie <cuiweixie@gmail.com>2022-09-05 15:06:38 +0800
committerRobert Griesemer <gri@google.com>2022-09-06 21:53:23 +0000
commit86f8b8d3f20129dce7a220d4ce32d13e766ba86a (patch)
tree936bc76d53e0270bc9625f483f1f699b92efdbc1 /src/cmd
parent50bb42a46f177d117acd2050e5b498ea15f06332 (diff)
downloadgo-86f8b8d3f20129dce7a220d4ce32d13e766ba86a.tar.xz
cmd/compile/internal/syntax: use strings.Builder
Change-Id: Ic18d12b3d1c2f4819f2656371537df797e9970ef Reviewed-on: https://go-review.googlesource.com/c/go/+/428361 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/compile/internal/syntax/printer.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/syntax/printer.go b/src/cmd/compile/internal/syntax/printer.go
index 9cf2cc8220..62de68ed66 100644
--- a/src/cmd/compile/internal/syntax/printer.go
+++ b/src/cmd/compile/internal/syntax/printer.go
@@ -7,7 +7,6 @@
package syntax
import (
- "bytes"
"fmt"
"io"
"strings"
@@ -47,7 +46,7 @@ func Fprint(w io.Writer, x Node, form Form) (n int, err error) {
// String is a convenience function that prints n in ShortForm
// and returns the printed string.
func String(n Node) string {
- var buf bytes.Buffer
+ var buf strings.Builder
_, err := Fprint(&buf, n, ShortForm)
if err != nil {
fmt.Fprintf(&buf, "<<< ERROR: %s", err)