mirror of
https://github.com/golang/go
synced 2024-11-18 17:24:40 -07:00
io: use strings.Builder
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>
This commit is contained in:
parent
c35bc69c97
commit
7c47c9773c
@ -5,7 +5,6 @@
|
|||||||
package io_test
|
package io_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
@ -239,7 +238,7 @@ func ExampleSeeker_Seek() {
|
|||||||
func ExampleMultiWriter() {
|
func ExampleMultiWriter() {
|
||||||
r := strings.NewReader("some io.Reader stream to be read\n")
|
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)
|
w := io.MultiWriter(&buf1, &buf2)
|
||||||
|
|
||||||
if _, err := io.Copy(w, r); err != nil {
|
if _, err := io.Copy(w, r); err != nil {
|
||||||
|
@ -228,7 +228,7 @@ func TestMultiReaderCopy(t *testing.T) {
|
|||||||
|
|
||||||
// Test that MultiWriter copies the input slice and is insulated from future modification.
|
// Test that MultiWriter copies the input slice and is insulated from future modification.
|
||||||
func TestMultiWriterCopy(t *testing.T) {
|
func TestMultiWriterCopy(t *testing.T) {
|
||||||
var buf bytes.Buffer
|
var buf strings.Builder
|
||||||
slice := []Writer{&buf}
|
slice := []Writer{&buf}
|
||||||
w := MultiWriter(slice...)
|
w := MultiWriter(slice...)
|
||||||
slice[0] = nil
|
slice[0] = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user