1
0
mirror of https://github.com/golang/go synced 2024-11-24 02:20:18 -07:00

go/parser: use strings.Builder

Change-Id: Ic8078543eb80470505a3cc2da8ea9fb8fb1369aa
GitHub-Last-Rev: 7b358c685a
GitHub-Pull-Request: golang/go#54919
Reviewed-on: https://go-review.googlesource.com/c/go/+/428922
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
cui fliter 2022-09-07 04:06:46 +00:00 committed by Gopher Robot
parent c75d19732d
commit 2e1f98e3a1

View File

@ -5,7 +5,6 @@
package parser
import (
"bytes"
"fmt"
"go/ast"
"go/token"
@ -298,7 +297,7 @@ type s3b struct { a, b *s3b; c []float }
"float " // s3a
// collect unresolved identifiers
var buf bytes.Buffer
var buf strings.Builder
for _, u := range f.Unresolved {
buf.WriteString(u.Name)
buf.WriteByte(' ')
@ -382,7 +381,7 @@ func getField(file *ast.File, fieldname string) *ast.Field {
// Don't use ast.CommentGroup.Text() - we want to see exact comment text.
func commentText(c *ast.CommentGroup) string {
var buf bytes.Buffer
var buf strings.Builder
if c != nil {
for _, c := range c.List {
buf.WriteString(c.Text)