mirror of
https://github.com/golang/go
synced 2024-11-23 04:00:03 -07:00
testing/fstest: optimize ReadDirFile func ReadDir
This commit is contained in:
parent
132c4fd870
commit
cc9a1d5a7e
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user