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

proposal: os: make os.dirFS implement fs.ReadFileFS and fs.ReadDirFS #59503

Closed
bvisness opened this issue Apr 8, 2023 · 3 comments
Closed

proposal: os: make os.dirFS implement fs.ReadFileFS and fs.ReadDirFS #59503

bvisness opened this issue Apr 8, 2023 · 3 comments

Comments

@bvisness
Copy link

bvisness commented Apr 8, 2023

The fs.FS returned by os.DirFS implements only fs.FS and fs.StatFS. It seems like it could easily implement fs.ReadFileFS and fs.ReadDirFS as well, but it currently does not.

My use case for this is trying to use a common interface for both embed.FS and os.DirFS, to load files on the fly in development but embed them in production. This is difficult, since embed.FS implements fs.ReadFileFS and fs.ReadDirFS, but os.DirFS implements only fs.StatFS.

I have implemented fs.ReadDirFS for myself and it seems to work fine. From reading other issues (#49580, #47803), I don't think this would have any issues with the restrictions around paths in fs.FS either.

@gopherbot gopherbot added this to the Proposal milestone Apr 8, 2023
@seankhliao
Copy link
Member

seankhliao commented Apr 9, 2023

Not sure if this needs a proposal, I think we've agreed to do ReadFile in #53761

@rsc
Copy link
Contributor

rsc commented Apr 12, 2023

Closing as duplicate of #53761.

@rsc
Copy link
Contributor

rsc commented Apr 12, 2023

This proposal is a duplicate of a previously discussed proposal, as noted above,
and there is no significant new information to justify reopening the discussion.
The issue has therefore been declined as a duplicate.
— rsc for the proposal review group

@rsc rsc closed this as completed Apr 12, 2023
@golang golang locked and limited conversation to collaborators Apr 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants