]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/syntax: use strings.Builder
authorcuiweixie <cuiweixie@gmail.com>
Mon, 5 Sep 2022 07:06:38 +0000 (15:06 +0800)
committerRobert Griesemer <gri@google.com>
Tue, 6 Sep 2022 21:53:23 +0000 (21:53 +0000)
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>
src/cmd/compile/internal/syntax/printer.go

index 9cf2cc8220737a553a04f389087398a612af62e4..62de68ed661723ba6f86b98d5e03c979d06b9b1f 100644 (file)
@@ -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)