From ceefd3a37bb2a77b1e9a76fc74360c68ef16ddb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammed=20Can=20K=C3=BC=C3=A7=C3=BCkaslan?= <32893303+Kucukaslan@users.noreply.github.com> Date: Sun, 24 Jul 2022 21:44:11 +0000 Subject: [PATCH] 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: b04724a072d956db1f84a8f5db0afa0dbb158e96 GitHub-Pull-Request: golang/go#54020 Reviewed-on: https://go-review.googlesource.com/c/go/+/419237 Reviewed-by: Cherry Mui Reviewed-by: Joseph Tsai TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Auto-Submit: Ian Lance Taylor --- src/bytes/reader.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/bytes/reader.go b/src/bytes/reader.go index 5946cf9780b0e..81c22aa0295d6 100644 --- a/src/bytes/reader.go +++ b/src/bytes/reader.go @@ -32,8 +32,7 @@ func (r *Reader) Len() int { // Size returns the original length of the underlying byte slice. // Size is the number of bytes available for reading via ReadAt. -// The returned value is always the same and is not affected by calls -// to any other method. +// The result is unaffected by any method calls except Reset. func (r *Reader) Size() int64 { return int64(len(r.s)) } // Read implements the io.Reader interface.