Commit 09686a58 authored by Robert Griesemer's avatar Robert Griesemer

cmd/compile: remove another bytes.Buffer use in fmt.go

Missed in prior commit.

Change-Id: Ib3a41fb4e4d41feeb28c316fe70a329c73e72379
Reviewed-on: https://go-review.googlesource.com/29088
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
parent 37d452c3
......@@ -5,7 +5,6 @@
package gc
import (
"bytes"
"cmd/internal/obj"
"fmt"
"strconv"
......@@ -739,35 +738,35 @@ func (t *Type) typefmt(flag FmtFlag) string {
Yyerror("unknown internal map type")
}
var buf bytes.Buffer
buf := make([]byte, 0, 64)
if t.IsFuncArgStruct() {
buf.WriteString("(")
buf = append(buf, '(')
var flag1 FmtFlag
if fmtmode == FTypeId || fmtmode == FErr { // no argument names on function signature, and no "noescape"/"nosplit" tags
flag1 = FmtShort
}
for i, f := range t.Fields().Slice() {
if i != 0 {
buf.WriteString(", ")
buf = append(buf, ", "...)
}
buf.WriteString(Fldconv(f, flag1))
buf = append(buf, Fldconv(f, flag1)...)
}
buf.WriteString(")")
buf = append(buf, ')')
} else {
buf.WriteString("struct {")
buf = append(buf, "struct {"...)
for i, f := range t.Fields().Slice() {
if i != 0 {
buf.WriteString(";")
buf = append(buf, ';')
}
buf.WriteString(" ")
buf.WriteString(Fldconv(f, FmtLong))
buf = append(buf, ' ')
buf = append(buf, Fldconv(f, FmtLong)...)
}
if t.NumFields() != 0 {
buf.WriteString(" ")
buf = append(buf, ' ')
}
buf.WriteString("}")
buf = append(buf, '}')
}
return buf.String()
return string(buf)
case TFORW:
if t.Sym != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment