Replace bytes.Buffer with strings.Builder where appropriate (#3347)

To build strings more efficiently, use strings.Builder instead.
This commit is contained in:
hopehook
2023-01-20 09:51:42 +08:00
committed by GitHub
parent 8cd11c82e4
commit b2d4185eec
4 changed files with 20 additions and 21 deletions

View File

@ -5,7 +5,6 @@
package gin
import (
"bytes"
"errors"
"fmt"
"html/template"
@ -13,6 +12,7 @@ import (
"log"
"os"
"runtime"
"strings"
"sync"
"testing"
@ -138,7 +138,7 @@ func captureOutput(t *testing.T, f func()) string {
wg := new(sync.WaitGroup)
wg.Add(1)
go func() {
var buf bytes.Buffer
var buf strings.Builder
wg.Done()
_, err := io.Copy(&buf, reader)
assert.NoError(t, err)