mirror of
https://github.com/golang/go
synced 2024-09-29 11:34:32 -06:00
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: a16a60b0f1
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>
This commit is contained in:
parent
7cc4516ac8
commit
9eceffdf12
@ -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} }
|
||||
|
Loading…
Reference in New Issue
Block a user