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,12 +5,12 @@
package gin
import (
"bytes"
"fmt"
"math/rand"
"net/http"
"net/http/httptest"
"os"
"strings"
"testing"
"github.com/stretchr/testify/assert"
@ -401,7 +401,7 @@ func TestGithubAPI(t *testing.T) {
}
func exampleFromPath(path string) (string, Params) {
output := new(bytes.Buffer)
output := new(strings.Builder)
params := make(Params, 0, 6)
start := -1
for i, c := range path {