Skip to content

Commit ad04342

Browse files
13mtfbgopherbot
authored andcommitted
fs: clarify documentation for ReadDir method
The fs.ReadDir method behaves the same way as os.ReadDir, in that when n <= 0, ReadDir returns all DirEntry values remaining in the dictionary. Update the comment to reflect that only remaining DirEntry values are returned (not all entries), for subsequent calls. Fixes #69301 Change-Id: I41ef7ef1c8e3fe7d64586f5297512697dc60dd40 Reviewed-on: https://go-review.googlesource.com/c/go/+/663215 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Sean Liao <sean@liao.dev> Auto-Submit: Sean Liao <sean@liao.dev> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent a4d0269 commit ad04342

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/io/fs/fs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ type ReadDirFile interface {
129129
// At the end of a directory, the error is io.EOF.
130130
// (ReadDir must return io.EOF itself, not an error wrapping io.EOF.)
131131
//
132-
// If n <= 0, ReadDir returns all the DirEntry values from the directory
132+
// If n <= 0, ReadDir returns all remaining DirEntry values from the directory
133133
// in a single slice. In this case, if ReadDir succeeds (reads all the way
134134
// to the end of the directory), it returns the slice and a nil error.
135135
// If it encounters an error before the end of the directory,

0 commit comments

Comments
 (0)