@@ -467,7 +467,7 @@ func LimitReader(r Reader, n int64) Reader { return &LimitedReader{R: r, N: n} }
467467//
468468// Negative values of N mean that the limit has been exceeded.
469469// Read returns Err when more than N bytes are read from R.
470- // If Err is nil or EOF , Read returns EOF instead .
470+ // If Err is nil, Read returns EOF.
471471type LimitedReader struct {
472472 R Reader // underlying reader
473473 N int64 // max bytes remaining
@@ -492,15 +492,15 @@ func (l *LimitedReader) Read(p []byte) (n int, err error) {
492492 }
493493
494494 if l .N < 0 {
495- if l .N == - 1 && l .Err != nil && l . Err != EOF {
495+ if l .N == - 1 && l .Err != nil {
496496 return 0 , l .Err // limit was exceeded
497497 }
498498 return 0 , EOF // stream was exactly N bytes, or already past limit
499499 }
500500
501501 // At limit (N == 0) - need to determine if stream has more data
502502
503- if l .Err == nil || l . Err == EOF {
503+ if l .Err == nil {
504504 return 0 , EOF
505505 }
506506
@@ -511,7 +511,7 @@ func (l *LimitedReader) Read(p []byte) (n int, err error) {
511511 // a byte from R, so we cache the result in N to avoid re-probing.
512512 var probe [1 ]byte
513513 probeN , probeErr := l .R .Read (probe [:])
514- if probeN > 0 || ( probeErr != nil && probeErr != EOF ) {
514+ if probeN > 0 || probeErr != EOF {
515515 l .N = - 1 // more data available, limit exceeded
516516 return 0 , l .Err
517517 }
0 commit comments