From 7c47c9773cc3847f8851a04753f7f008b2add3b1 Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Sun, 4 Sep 2022 18:05:12 +0800 Subject: [PATCH] io: use strings.Builder Change-Id: Ibab20627ccd1f79e77e3972e2bc6ca42c2c7de13 Reviewed-on: https://go-review.googlesource.com/c/go/+/428263 TryBot-Result: Gopher Robot Auto-Submit: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Reviewed-by: Robert Griesemer Reviewed-by: Ian Lance Taylor --- src/io/example_test.go | 3 +-- src/io/multi_test.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/io/example_test.go b/src/io/example_test.go index 419e449982..818020e9de 100644 --- a/src/io/example_test.go +++ b/src/io/example_test.go @@ -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 { diff --git a/src/io/multi_test.go b/src/io/multi_test.go index 679312c23b..7a24a8afc5 100644 --- a/src/io/multi_test.go +++ b/src/io/multi_test.go @@ -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 -- 2.50.0