1
0
mirror of https://github.com/golang/go synced 2024-11-17 01:04:50 -07:00

encoding/binary: use built-in clear to simplify code

Change-Id: I2f3c7f4a4848ad0fbbf79bd8919b1e2abee72f3f
GitHub-Last-Rev: 06d0047b28
GitHub-Pull-Request: golang/go#66136
Reviewed-on: https://go-review.googlesource.com/c/go/+/569280
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Jes Cok 2024-03-06 17:07:48 +00:00 committed by Gopher Robot
parent d463de61b3
commit e2459e627f

View File

@ -765,10 +765,7 @@ func (d *decoder) skip(v reflect.Value) {
func (e *encoder) skip(v reflect.Value) {
n := dataSize(v)
zero := e.buf[e.offset : e.offset+n]
for i := range zero {
zero[i] = 0
}
clear(e.buf[e.offset : e.offset+n])
e.offset += n
}