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 {