1
0
mirror of https://github.com/golang/go synced 2024-11-23 06:50:05 -07:00

bytes: document that Reader.Reset affects the result of Size

The Reader.Reset changes the underlying byte slice, so it actually
changes the return value of the Size method.

Fixes #54018

Change-Id: I160deaa2244e95cb93303cb5dfb67a8d90a375ef
GitHub-Last-Rev: b04724a072
GitHub-Pull-Request: golang/go#54020
Reviewed-on: https://go-review.googlesource.com/c/go/+/419237
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Muhammed Can Küçükaslan 2022-07-24 21:44:11 +00:00 committed by Gopher Robot
parent 3e97294663
commit ceefd3a37b

View File

@ -32,8 +32,7 @@ func (r *Reader) Len() int {
// Size returns the original length of the underlying byte slice. // Size returns the original length of the underlying byte slice.
// Size is the number of bytes available for reading via ReadAt. // Size is the number of bytes available for reading via ReadAt.
// The returned value is always the same and is not affected by calls // The result is unaffected by any method calls except Reset.
// to any other method.
func (r *Reader) Size() int64 { return int64(len(r.s)) } func (r *Reader) Size() int64 { return int64(len(r.s)) }
// Read implements the io.Reader interface. // Read implements the io.Reader interface.