]> Cypherpunks repositories - gostls13.git/commitdiff
bytes: use clear in test
authorKir Kolyshkin <kolyshkin@gmail.com>
Thu, 18 Sep 2025 00:59:32 +0000 (17:59 -0700)
committerSean Liao <sean@liao.dev>
Thu, 18 Sep 2025 22:30:59 +0000 (15:30 -0700)
Replace for loop with clear built-in, available since Go 1.21.

Change-Id: I66d0124b9004ffd0b52abb679ccff86bb600c1e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/704878
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
src/bytes/bytes_test.go

index 03f01582c59a4668b678fccac32f00918cd0475e..f18915c879e097e2ebd64ec70cfe631f7246adc4 100644 (file)
@@ -891,9 +891,7 @@ func BenchmarkCountSingle(b *testing.B) {
                                b.Fatal("bad count", j, expect)
                        }
                }
-               for i := 0; i < len(buf); i++ {
-                       buf[i] = 0
-               }
+               clear(buf)
        })
 }