aboutsummaryrefslogtreecommitdiff
path: root/src/io
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-04-19 16:05:01 -0700
committerIan Lance Taylor <iant@golang.org>2021-04-21 16:46:52 +0000
commit35806efda21242df2c56ca276a842481acf6fea0 (patch)
tree3a54fc827fce7a521288540afd59c6b292396a75 /src/io
parentb8a359d984b9b16a405fa66011078a477c6e2da4 (diff)
downloadgo-35806efda21242df2c56ca276a842481acf6fea0.tar.gz
go-35806efda21242df2c56ca276a842481acf6fea0.zip
io/fs: document that caller can modify slice returned by ReadFile
Also add a test to testing/fstest. Fixes #45186 Change-Id: I00e5f46ccd5269dbc266a8f2ebc9a62ebb1297b8 Reviewed-on: https://go-review.googlesource.com/c/go/+/311649 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/io')
-rw-r--r--src/io/fs/readfile.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/io/fs/readfile.go b/src/io/fs/readfile.go
index 7ee9eadac4..d3c181c0a9 100644
--- a/src/io/fs/readfile.go
+++ b/src/io/fs/readfile.go
@@ -15,6 +15,9 @@ type ReadFileFS interface {
// A successful call returns a nil error, not io.EOF.
// (Because ReadFile reads the whole file, the expected EOF
// from the final Read is not treated as an error to be reported.)
+ //
+ // The caller is permitted to modify the returned byte slice.
+ // This method should return a copy of the underlying data.
ReadFile(name string) ([]byte, error)
}