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

Open
mknyszek opened this issue Jul 7, 2021 · 2 comments
Open

Comments

@mknyszek
Copy link
Contributor

@mknyszek 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.

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 7, 2021

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

Loading

@neild
Copy link
Contributor

@neild 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.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants