1
0
mirror of https://github.com/golang/go synced 2024-11-24 07:50:13 -07:00

encoding: simplify some code

Change-Id: I63aac663da4ce7bdd198d385f87929c74f6a5cf8
Reviewed-on: https://go-review.googlesource.com/c/go/+/360601
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2021-11-01 17:27:09 -07:00
parent 926856542f
commit 65f3478633
3 changed files with 3 additions and 9 deletions

View File

@ -142,9 +142,7 @@ func (e *encoder) Write(p []byte) (n int, err error) {
}
// Trailing fringe.
for i := 0; i < len(p); i++ {
e.buf[i] = p[i]
}
copy(e.buf[:], p)
e.nbuf = len(p)
n += len(p)
return

View File

@ -221,9 +221,7 @@ func (e *encoder) Write(p []byte) (n int, err error) {
}
// Trailing fringe.
for i := 0; i < len(p); i++ {
e.buf[i] = p[i]
}
copy(e.buf[:], p)
e.nbuf = len(p)
n += len(p)
return

View File

@ -229,9 +229,7 @@ func (e *encoder) Write(p []byte) (n int, err error) {
}
// Trailing fringe.
for i := 0; i < len(p); i++ {
e.buf[i] = p[i]
}
copy(e.buf[:], p)
e.nbuf = len(p)
n += len(p)
return