First of all thanks for sharing this great project!
While switching between mem.FS and os.FS for different use cases, I noticed that the value returned by (*os.FS).Sub() could not be passed verbatim to receivers that accept an interface such as hpfs.RemoveFS. This is because both Sub() and Subvolume() return a generic hpfs.FS interface instead of the concrete *os.FS type.
It is a common practice in Go to "accept interfaces, return concrete types" and, since there is no ambiguity here, I believe that returning the concrete *os.FS is the right thing to do. It avoids awkward assertions such as:
First of all thanks for sharing this great project!
While switching between
mem.FS
andos.FS
for different use cases, I noticed that the value returned by(*os.FS).Sub()
could not be passed verbatim to receivers that accept an interface such ashpfs.RemoveFS
. This is because bothSub()
andSubvolume()
return a generichpfs.FS
interface instead of the concrete*os.FS
type.It is a common practice in Go to "accept interfaces, return concrete types" and, since there is no ambiguity here, I believe that returning the concrete
*os.FS
is the right thing to do. It avoids awkward assertions such as: