]> Cypherpunks repositories - gostls13.git/commitdiff
io: clarify Reader returning 0, nil
authorRuss Cox <rsc@golang.org>
Tue, 16 Sep 2014 14:01:28 +0000 (10:01 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 16 Sep 2014 14:01:28 +0000 (10:01 -0400)
Fixes #8317.

LGTM=bradfitz
R=bradfitz, iant, r
CC=golang-codereviews
https://golang.org/cl/143100043

src/io/io.go

index e8bbad537c61f81c690a3d72294fdd26351cd12c..7507a84929f8ab950b7dba263e089cc5c0236b00 100644 (file)
@@ -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)
 }