]> Cypherpunks repositories - gostls13.git/commitdiff
io: update documentation on LimitedReader
authorJoe Tsai <joetsai@digital-static.net>
Fri, 9 Dec 2016 21:11:48 +0000 (13:11 -0800)
committerJoe Tsai <thebrokentoaster@gmail.com>
Fri, 9 Dec 2016 23:19:06 +0000 (23:19 +0000)
Specify that that LimitedReader returns EOF when the underlying
R returns EOF even if bytes remaining, N > 0.

Fixes #18271

Change-Id: I990a7135f1d31488d535238ae061d42ee96bacb7
Reviewed-on: https://go-review.googlesource.com/34249
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/io/io.go

index 3cab7288c97f5e8532e22bc796aee90fca8d730f..9e4b86594d8128d93ad406be78c2f3bcbcd365f4 100644 (file)
@@ -420,6 +420,7 @@ func LimitReader(r Reader, n int64) Reader { return &LimitedReader{r, n} }
 // A LimitedReader reads from R but limits the amount of
 // data returned to just N bytes. Each call to Read
 // updates N to reflect the new amount remaining.
+// Read returns EOF when N <= 0 or when the underlying R returns EOF.
 type LimitedReader struct {
        R Reader // underlying reader
        N int64  // max bytes remaining