mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
testing/fstest: optimize ReadDirFile func ReadDir
This commit is contained in:
parent
132c4fd870
commit
cc9a1d5a7e
1 changed files with 1 additions and 4 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue