Skip to content

Commit aedf298

Browse files
committed
io/fs: document requirement that ReadDir return an unwrapped io.EOF
This requirement ensures that ReadDir implementations are as compatible as possible with "*os.File".ReadDir. The testing/fstest package already tests for equality to io.EOF. Updates #47062. Fixes #47086. Change-Id: I54f911a34e507a3db0abc4da55a19b7a50b35041 Reviewed-on: https://go-review.googlesource.com/c/go/+/333149 Reviewed-by: Michael Knyszek <[email protected]>
1 parent f2b1cde commit aedf298

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/io/fs/fs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ type ReadDirFile interface {
120120
// In this case, if ReadDir returns an empty slice, it will return
121121
// a non-nil error explaining why.
122122
// At the end of a directory, the error is io.EOF.
123+
// (ReadDir must return io.EOF itself, not an error wrapping io.EOF.)
123124
//
124125
// If n <= 0, ReadDir returns all the DirEntry values from the directory
125126
// in a single slice. In this case, if ReadDir succeeds (reads all the way

0 commit comments

Comments
 (0)