You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
The
fs.FS
returned byos.DirFS
implements onlyfs.FS
andfs.StatFS
. It seems like it could easily implementfs.ReadFileFS
andfs.ReadDirFS
as well, but it currently does not.My use case for this is trying to use a common interface for both
embed.FS
andos.DirFS
, to load files on the fly in development but embed them in production. This is difficult, sinceembed.FS
implementsfs.ReadFileFS
andfs.ReadDirFS
, butos.DirFS
implements onlyfs.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 infs.FS
either.The text was updated successfully, but these errors were encountered: