aboutsummaryrefslogtreecommitdiff
path: root/src/io
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2023-05-25 11:31:28 -0700
committerGopher Robot <gobot@golang.org>2023-05-26 17:03:12 +0000
commit1ff89009f198ad5bae3549dd3b992882bd97e5f8 (patch)
tree1e15949c17b230110545a0a976f1e14885ccdec5 /src/io
parent13be9fa7f896b876775f964e167cdd44166438eb (diff)
downloadgo-1ff89009f198ad5bae3549dd3b992882bd97e5f8.tar.gz
go-1ff89009f198ad5bae3549dd3b992882bd97e5f8.zip
io: clarify that Read(nil) can return 0, EOF
Fixes #40385 Change-Id: I965b5db985fd4418a992e883073cbc8309b2cb88 Reviewed-on: https://go-review.googlesource.com/c/go/+/498355 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Rob Pike <r@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/io')
-rw-r--r--src/io/io.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/io/io.go b/src/io/io.go
index bcb9f774f6..01f36e0ce1 100644
--- a/src/io/io.go
+++ b/src/io/io.go
@@ -74,6 +74,9 @@ var ErrNoProgress = errors.New("multiple Read calls return no data or error")
// that happen after reading some bytes and also both of the
// allowed EOF behaviors.
//
+// If len(p) == 0, Read should always return n == 0. It may return a
+// non-nil error if some error condition is known, such as EOF.
+//
// Implementations of Read are discouraged from returning a
// zero byte count with a nil error, except when len(p) == 0.
// Callers should treat a return of 0 and nil as indicating that