]> Cypherpunks repositories - gostls13.git/commitdiff
io: use strings.Builder
authorcuiweixie <cuiweixie@gmail.com>
Sun, 4 Sep 2022 10:05:12 +0000 (18:05 +0800)
committerGopher Robot <gobot@golang.org>
Tue, 6 Sep 2022 15:49:32 +0000 (15:49 +0000)
Change-Id: Ibab20627ccd1f79e77e3972e2bc6ca42c2c7de13
Reviewed-on: https://go-review.googlesource.com/c/go/+/428263
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/io/example_test.go
src/io/multi_test.go

index 419e449982ad5cabc16b92aa628b22897b9f5848..818020e9dec6dd1b11456d996f123403b8b9bcdf 100644 (file)
@@ -5,7 +5,6 @@
 package io_test
 
 import (
-       "bytes"
        "fmt"
        "io"
        "log"
@@ -239,7 +238,7 @@ func ExampleSeeker_Seek() {
 func ExampleMultiWriter() {
        r := strings.NewReader("some io.Reader stream to be read\n")
 
-       var buf1, buf2 bytes.Buffer
+       var buf1, buf2 strings.Builder
        w := io.MultiWriter(&buf1, &buf2)
 
        if _, err := io.Copy(w, r); err != nil {
index 679312c23b01c518d1fe6bb896fc610a1cb5fc1c..7a24a8afc5a419ba433791536602366b00e0158d 100644 (file)
@@ -228,7 +228,7 @@ func TestMultiReaderCopy(t *testing.T) {
 
 // Test that MultiWriter copies the input slice and is insulated from future modification.
 func TestMultiWriterCopy(t *testing.T) {
-       var buf bytes.Buffer
+       var buf strings.Builder
        slice := []Writer{&buf}
        w := MultiWriter(slice...)
        slice[0] = nil