]> Cypherpunks.ru repositories - gostls13.git/commitdiff
io/fs: document requirement that ReadDir return an unwrapped io.EOF
authorDamien Neil <dneil@google.com>
Wed, 7 Jul 2021 16:32:17 +0000 (09:32 -0700)
committerDamien Neil <dneil@google.com>
Tue, 17 May 2022 01:50:34 +0000 (01:50 +0000)
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 <mknyszek@google.com>
src/io/fs/fs.go

index 5c0d9a666486958f3aee28a43c65c5c279c9d952..4ce4d1a5282ff324ae905deddc5b27e4808d2b3e 100644 (file)
@@ -120,6 +120,7 @@ type ReadDirFile interface {
        // In this case, if ReadDir returns an empty slice, it will return
        // a non-nil error explaining why.
        // At the end of a directory, the error is io.EOF.
+       // (ReadDir must return io.EOF itself, not an error wrapping io.EOF.)
        //
        // If n <= 0, ReadDir returns all the DirEntry values from the directory
        // in a single slice. In this case, if ReadDir succeeds (reads all the way