Closed ainar-g closed 3 years ago
I have only used fs.FS
when working with the embed
package thus far, so my experience with it is limited.
When you suggest adding a version of TempFile
that accepts fs.FS
, what sort of use-cases would that make possible? Can you provide an example or a specific motivation?
renameio
needs os.OpenFile
(to create a new file), (*os.File).Sync
and os.Rename
. AFAICT, fs.FS
offers none of these, so we’d need to use interface assertions, or a custom interface to begin with.
fs.FS only supports read-only filesystems, and so is not suitable for renameio.
I was under a false impression that package io/fs
provided extension interfaces for writable filesystems, but I now see that that is not the case. Apologies for the noise.
Considering that the package is quite low-level at times, would it be at all possible to add support for the
fs.FS
interface? For example, to have versions ofTempDir
andTempFile
that acceptfs.FS
? And perhaps the latter would return a modified version offs.File
?