aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2012-01-13 11:48:57 -0800
committerBrad Fitzpatrick <bradfitz@golang.org>2012-01-13 11:48:57 -0800
commit87ceb0cec73b93064be4b65da6bee265addc2027 (patch)
tree774ad628edbeddd1ce9fa52fc6d0ad6dd6db95bc
parenteaecf357e76478d9956988423f00171887977b7c (diff)
downloadgo-87ceb0cec73b93064be4b65da6bee265addc2027.tar.gz
go-87ceb0cec73b93064be4b65da6bee265addc2027.zip
bytes: make Write and WriteString code look the same
R=golang-dev, r CC=golang-dev https://golang.org/cl/5540056
-rw-r--r--src/pkg/bytes/buffer.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/pkg/bytes/buffer.go b/src/pkg/bytes/buffer.go
index 066023a3ec..77757af1d8 100644
--- a/src/pkg/bytes/buffer.go
+++ b/src/pkg/bytes/buffer.go
@@ -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