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>
package syntax
import (
- "bytes"
"fmt"
"io"
"strings"
// 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)