]> Cypherpunks repositories - gostls13.git/commitdiff
bytes: make Write and WriteString code look the same
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 13 Jan 2012 19:48:57 +0000 (11:48 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 13 Jan 2012 19:48:57 +0000 (11:48 -0800)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5540056

src/pkg/bytes/buffer.go

index 066023a3ec9ace12e9218f8d872317df4594e88d..77757af1d804fc501693ff416ac92c65ce425284 100644 (file)
@@ -97,8 +97,7 @@ func (b *Buffer) grow(n int) int {
 func (b *Buffer) Write(p []byte) (n int, err error) {
        b.lastRead = opInvalid
        m := b.grow(len(p))
-       copy(b.buf[m:], p)
-       return len(p), nil
+       return copy(b.buf[m:], p), nil
 }
 
 // WriteString appends the contents of s to the buffer.  The return