We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e6f9f39 commit 106ebe2Copy full SHA for 106ebe2
src/os/dir.go
@@ -4,6 +4,8 @@
4
5
package os
6
7
+import "errors"
8
+
9
// Readdir reads the contents of the directory associated with file and
10
// returns a slice of up to n FileInfo values, as would be returned
11
// by Lstat, in directory order. Subsequent calls on the same file will yield
@@ -23,7 +25,11 @@ func (f *File) Readdir(n int) ([]FileInfo, error) {
23
25
if f == nil {
24
26
return nil, ErrInvalid
27
}
- return f.readdir(n)
28
+ fi, err := f.readdir(n)
29
+ if err == nil && len(fi) == 0 && n > 0 {
30
+ err = errors.New("no files found")
31
+ }
32
+ return fi, err
33
34
35
// Readdirnames reads and returns a slice of names from the directory f.
0 commit comments