1
0
mirror of https://github.com/golang/go synced 2024-09-28 19:24:29 -06:00

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>
This commit is contained in:
Ian Lance Taylor 2023-05-25 11:31:28 -07:00 committed by Gopher Robot
parent 13be9fa7f8
commit 1ff89009f1

View File

@ -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