Skip to content

Commit 1ff8900

Browse files
ianlancetaylorgopherbot
authored andcommittedMay 26, 2023
io: clarify that Read(nil) can return 0, EOF
Fixes golang#40385 Change-Id: I965b5db985fd4418a992e883073cbc8309b2cb88 Reviewed-on: https://go-review.googlesource.com/c/go/+/498355 Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-by: Rob Pike <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]>
1 parent 13be9fa commit 1ff8900

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
 

‎src/io/io.go

+3
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ var ErrNoProgress = errors.New("multiple Read calls return no data or error")
7474
// that happen after reading some bytes and also both of the
7575
// allowed EOF behaviors.
7676
//
77+
// If len(p) == 0, Read should always return n == 0. It may return a
78+
// non-nil error if some error condition is known, such as EOF.
79+
//
7780
// Implementations of Read are discouraged from returning a
7881
// zero byte count with a nil error, except when len(p) == 0.
7982
// Callers should treat a return of 0 and nil as indicating that

0 commit comments

Comments
 (0)