prefixfs
Makes an underlying filesystem accessible only under a prefix path. The inverse of fs.Sub.
Design
New(fsys, prefix)panics if the cleaned prefix is not a valid, non-rootfs.ValidPath- Opening
"."or any ancestor of the prefix returns a syntheticdirthat lists only the next path component - Opening exactly the prefix returns the underlying FS root (
".") - Opening a path under the prefix strips the prefix and delegates to the underlying FS
Key Types
dir: synthetic read-only directory returned for paths above the prefix boundarydirEntry/dirInfo: minimalfs.DirEntry/fs.FileInfofor synthetic directories
Relationships
- Pure
io/fspackage — does not depend onihfstypes; usable with anyfs.FS
Coverage
Aim for high coverage, but do not write messy or low-value tests just to hit 100%. If a branch requires complex setup with little benefit, skip it.