From 0163b3b32cad2ed3331e2b197c68387f12246cd8 Mon Sep 17 00:00:00 2001 From: cui fliter Date: Sun, 20 Aug 2023 18:33:50 +0800 Subject: all: remove redundant string conversions when formatting []byte with %s Change-Id: I603051a3174b139ffb81d20d42979c7f3f04a09a Reviewed-on: https://go-review.googlesource.com/c/go/+/521136 Run-TryBot: Filippo Valsorda Auto-Submit: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Reviewed-by: Bryan Mills Run-TryBot: shuang cui Reviewed-by: Filippo Valsorda TryBot-Result: Gopher Robot --- src/bytes/example_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/bytes/example_test.go') diff --git a/src/bytes/example_test.go b/src/bytes/example_test.go index 41a5e2e5bf..20faf3e1f5 100644 --- a/src/bytes/example_test.go +++ b/src/bytes/example_test.go @@ -81,9 +81,9 @@ func ExampleBuffer_Next() { var b bytes.Buffer b.Grow(64) b.Write([]byte("abcde")) - fmt.Printf("%s\n", string(b.Next(2))) - fmt.Printf("%s\n", string(b.Next(2))) - fmt.Printf("%s", string(b.Next(2))) + fmt.Printf("%s\n", b.Next(2)) + fmt.Printf("%s\n", b.Next(2)) + fmt.Printf("%s", b.Next(2)) // Output: // ab // cd -- cgit v1.3-5-g9baa