test: simplify bytes.Buffer declaration (#1523)

This commit is contained in:
Oleksandr Redko
2023-03-18 15:40:25 +02:00
committed by GitHub
parent faf565e222
commit 0be5a4150c
2 changed files with 5 additions and 10 deletions
+1 -2
View File
@@ -99,8 +99,7 @@ func main() {
return a
}()
w := new(bytes.Buffer)
w.WriteString(pre)
w := bytes.NewBufferString(pre)
fmt.Fprintf(w, "const hex2intTable = %q\n", hex2intTable)
fmt.Fprintf(w, "const toLowerTable = %q\n", toLowerTable)
fmt.Fprintf(w, "const toUpperTable = %q\n", toUpperTable)
+4 -8
View File
@@ -2740,8 +2740,7 @@ func TestResponseImmediateHeaderFlushFixedLength(t *testing.T) {
r.SetBodyStream(buf, 3)
b := []byte{}
w := bytes.NewBuffer(b)
w := &bytes.Buffer{}
bb := bufio.NewWriter(w)
bw := &r
@@ -2786,8 +2785,7 @@ func TestResponseImmediateHeaderFlushFixedLengthSkipBody(t *testing.T) {
r.SetBodyStream(buf, 0)
b := []byte{}
w := bytes.NewBuffer(b)
w := &bytes.Buffer{}
bb := bufio.NewWriter(w)
var headersOnClose string
@@ -2821,8 +2819,7 @@ func TestResponseImmediateHeaderFlushChunked(t *testing.T) {
r.SetBodyStream(buf, -1)
b := []byte{}
w := bytes.NewBuffer(b)
w := &bytes.Buffer{}
bb := bufio.NewWriter(w)
bw := &r
@@ -2868,8 +2865,7 @@ func TestResponseImmediateHeaderFlushChunkedNoBody(t *testing.T) {
r.SetBodyStream(buf, -1)
b := []byte{}
w := bytes.NewBuffer(b)
w := &bytes.Buffer{}
bb := bufio.NewWriter(w)
var headersOnClose string