net/http/httputil: use strings.Builder

Change-Id: Ifb51413894791154489bd1d4f529088958212c62
Reviewed-on: https://go-review.googlesource.com/c/go/+/428270
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
cuiweixie 2022-09-04 18:37:30 +08:00 committed by Damien Neil
parent 1207ee896c
commit ce8dcd9879
2 changed files with 2 additions and 2 deletions

View File

@ -523,7 +523,7 @@ func TestDumpRequestOutIssue38352(t *testing.T) {
select {
case <-out:
case <-time.After(timeout):
b := &bytes.Buffer{}
b := &strings.Builder{}
fmt.Fprintf(b, "deadlock detected on iteration %d after %s with delay: %v\n", i, timeout, delay)
pprof.Lookup("goroutine").WriteTo(b, 1)
t.Fatal(b.String())

View File

@ -1123,7 +1123,7 @@ func TestModifyResponseClosesBody(t *testing.T) {
req, _ := http.NewRequest("GET", "http://foo.tld/", nil)
req.RemoteAddr = "1.2.3.4:56789"
closeCheck := new(checkCloser)
logBuf := new(bytes.Buffer)
logBuf := new(strings.Builder)
outErr := errors.New("ModifyResponse error")
rp := &ReverseProxy{
Director: func(req *http.Request) {},