From: Matthew Burton <13mtfb@gmail.com> Date: Sat, 5 Apr 2025 20:56:42 +0000 (-0400) Subject: fs: clarify documentation for ReadDir method X-Git-Tag: go1.25rc1~438 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ad0434200c4b17c339852c8c0ec0c0212f8563d9;p=gostls13.git 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 Reviewed-by: Sean Liao Auto-Submit: Sean Liao Reviewed-by: Jorropo Reviewed-by: David Chase LUCI-TryBot-Result: Go LUCI --- diff --git a/src/io/fs/fs.go b/src/io/fs/fs.go index 9e19e6a797..8f693f2574 100644 --- a/src/io/fs/fs.go +++ b/src/io/fs/fs.go @@ -129,7 +129,7 @@ type ReadDirFile interface { // 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 + // If n <= 0, ReadDir returns all remaining DirEntry values from the directory // in a single slice. In this case, if ReadDir succeeds (reads all the way // to the end of the directory), it returns the slice and a nil error. // If it encounters an error before the end of the directory,