diff options
| author | Jabar Asadi <jasadi@d2iq.com> | 2023-05-10 21:44:14 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-05-12 17:40:51 +0000 |
| commit | 9eceffdf12dc4497ee162c005d5e14bb509797b9 (patch) | |
| tree | 67bf005cc6ed7b8f3c97003357cb8c98e146e214 | |
| parent | 7cc4516ac8305acf3689a2b755932512a1bf6efd (diff) | |
| download | go-9eceffdf12dc4497ee162c005d5e14bb509797b9.tar.xz | |
strings: correct NewReader documentation
The provided description for `NewReader` says that the underlying string is read-only. but the following example shows that this is not the case.
<br />
rd := strings.NewReader("this is a text")
rd.Reset("new text") <--- underlying string gets updated here
Change-Id: I95c7099c2e63670c84307d4317b702bf13a4025a
GitHub-Last-Rev: a16a60b0f1e25d19e05e664c5b41ca57c4fcd9b2
GitHub-Pull-Request: golang/go#60074
Reviewed-on: https://go-review.googlesource.com/c/go/+/493817
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
| -rw-r--r-- | src/strings/reader.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/strings/reader.go b/src/strings/reader.go index 6f069a62ca..04f31a1e8f 100644 --- a/src/strings/reader.go +++ b/src/strings/reader.go @@ -156,5 +156,5 @@ func (r *Reader) WriteTo(w io.Writer) (n int64, err error) { func (r *Reader) Reset(s string) { *r = Reader{s, 0, -1} } // NewReader returns a new Reader reading from s. -// It is similar to bytes.NewBufferString but more efficient and read-only. +// It is similar to bytes.NewBufferString but more efficient and non-writable. func NewReader(s string) *Reader { return &Reader{s, 0, -1} } |
