diff options
author | Russ Cox <rsc@golang.org> | 2014-09-16 10:01:28 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2014-09-16 10:01:28 -0400 |
commit | 6c954a06721de39012fcba957492617e783b2d7c (patch) | |
tree | 1e4696b30b66664fdf4c14edc50c3ee5a91b7267 /src | |
parent | 5560be89ea0ef280ce0ff547e50ced11059682d7 (diff) | |
download | go-6c954a06721de39012fcba957492617e783b2d7c.tar.gz |
io: clarify Reader returning 0, nil
Fixes issue 8317.
LGTM=bradfitz
R=bradfitz, iant, r
CC=golang-codereviews
https://codereview.appspot.com/143100043
Diffstat (limited to 'src')
-rw-r--r-- | src/io/io.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/io/io.go b/src/io/io.go index e8bbad537..7507a8492 100644 --- a/src/io/io.go +++ b/src/io/io.go @@ -62,8 +62,11 @@ var ErrNoProgress = errors.New("multiple Read calls return no data or error") // allowed EOF behaviors. // // Implementations of Read are discouraged from returning a -// zero byte count with a nil error, and callers should treat -// that situation as a no-op. Implementations must not retain p. +// zero byte count with a nil error, except when len(p) == 0. +// Callers should treat a return of 0 and nil as indicating that +// nothing happened; in particular it does not indicate EOF. +// +// Implementations must not retain p. type Reader interface { Read(p []byte) (n int, err error) } |