os: implement readdir for darwin and linux

readdir is disabled on linux for 386 and arm until syscall.seek is implemented there.

windows is hard, so leaving that for later.

File src/os/dir_other_go115.go can be deleted when we drop support for go 1.15.

Also adds TestReadNonDir, which was helpful while debugging.
This commit is contained in:
Dan Kegel
2022-01-08 12:28:32 -08:00
committed by Ron Evans
parent 3fa7d6cc40
commit 641a7e5cb9
20 changed files with 972 additions and 67 deletions
-9
View File
@@ -8,19 +8,10 @@ import (
)
type (
DirEntry = fs.DirEntry
FileMode = fs.FileMode
FileInfo = fs.FileInfo
)
func (f *File) ReadDir(n int) ([]DirEntry, error) {
return nil, &PathError{"ReadDir", f.name, ErrNotImplemented}
}
func ReadDir(name string) ([]DirEntry, error) {
return nil, &PathError{"ReadDir", name, ErrNotImplemented}
}
// The followings are copied from Go 1.16 official implementation:
// https://github.com/golang/go/blob/go1.16/src/os/file.go