Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io/fs: document ReadDirFile io.EOF implementation requirements more precisely #47086

Closed
mknyszek opened this issue Jul 7, 2021 · 2 comments
Closed
Labels
Documentation FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@mknyszek
Copy link
Contributor

mknyszek commented Jul 7, 2021

Splintering out from a discussion in #47062, it's probably worth pointing out that like an io.Reader, an fs.ReadDirFile's ReadDir should return only an io.EOF, and not anything wrapping it. Code in testing/fstest already depends on this behavior and assumes it for a correct implementation.

Alternatively, because this API is relatively new, it might still be possible to relax it to allow for wrapping. However, since it's already been almost one full release and io.EOF is already used a sentinel in other APIs, it doesn't seem worth it to break the pattern.

@mknyszek mknyszek added NeedsFix The path to resolution is known, but the work has not been done. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Jul 7, 2021
@mknyszek mknyszek added this to the Backlog milestone Jul 7, 2021
@gopherbot gopherbot added Documentation and removed NeedsFix The path to resolution is known, but the work has not been done. labels Jul 7, 2021
@gopherbot
Copy link

Change https://golang.org/cl/333149 mentions this issue: io/fs: document requirement that ReadDir return an unwrapped io.EOF

@neild
Copy link
Contributor

neild commented Jul 7, 2021

The fs.ReadDirFile interface is new, but "*os/File".ReadDir is old and returns an io.EOF sentinel without wrapping. Keeping the requirement that io.EOF be used without wrapping seems simplest.

@golang golang locked and limited conversation to collaborators May 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

3 participants