aboutsummaryrefslogtreecommitdiff
path: root/src/bytes/example_test.go
diff options
context:
space:
mode:
authorcui fliter <imcusg@gmail.com>2023-08-20 18:33:50 +0800
committerGopher Robot <gobot@golang.org>2023-08-22 22:52:37 +0000
commit0163b3b32cad2ed3331e2b197c68387f12246cd8 (patch)
tree37dc6b273af476869e38a4c6cc65e4482bf92437 /src/bytes/example_test.go
parent291a32aa4bd894eaad0517ce1ac3e04dd885cb8b (diff)
downloadgo-0163b3b32cad2ed3331e2b197c68387f12246cd8.tar.xz
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 <filippo@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: shuang cui <imcusg@gmail.com> Reviewed-by: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/bytes/example_test.go')
-rw-r--r--src/bytes/example_test.go6
1 files changed, 3 insertions, 3 deletions
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