From cc9a1d5a7e2599ee7f98c61d35b2450b9b6a92c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=BF=97=E4=BC=9F?= Date: Tue, 6 Apr 2021 10:59:03 +0800 Subject: [PATCH] testing/fstest: optimize ReadDirFile func ReadDir --- src/testing/fstest/mapfs.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/testing/fstest/mapfs.go b/src/testing/fstest/mapfs.go index 0ba5ae39a3a..9fef2f4696e 100644 --- a/src/testing/fstest/mapfs.go +++ b/src/testing/fstest/mapfs.go @@ -223,10 +223,7 @@ func (d *mapDir) Read(b []byte) (int, error) { func (d *mapDir) ReadDir(count int) ([]fs.DirEntry, error) { n := len(d.entry) - d.offset - if n == 0 { - if count <= 0 { - return nil, nil - } + if n == 0 && count > 0 { return nil, io.EOF } if count > 0 && n > count {