Skip to content

Commit 019297a

Browse files
jacobsabradfitz
authored andcommitted
os: remove a redundant branch in File.Read.
All implementations of File.read ensure that n >= 0. This is usually via fixCount, except for Windows console reads, which only ever add to n. Change-Id: Ic019d6a2da5ef1ac68d2690c908deca4fcc6b4a4 Reviewed-on: https://go-review.googlesource.com/12624 Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 3c9fa38 commit 019297a

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

src/os/file.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ func (f *File) Read(b []byte) (n int, err error) {
9393
return 0, ErrInvalid
9494
}
9595
n, e := f.read(b)
96-
if n < 0 {
97-
n = 0
98-
}
9996
if n == 0 && len(b) > 0 && e == nil {
10097
return 0, io.EOF
10198
}

0 commit comments

Comments
 (0)