Documentation ¶
Overview ¶
Package fsys is an abstraction for reading files that allows for virtual overlays on top of the files on disk.
Index ¶
- Variables
- func Glob(pattern string) (matches []string, err error)
- func Init(wd string) error
- func IsDir(path string) (bool, error)
- func IsDirWithGoFiles(dir string) (bool, error)
- func Lstat(path string) (fs.FileInfo, error)
- func Open(path string) (*os.File, error)
- func OpenFile(path string, flag int, perm os.FileMode) (*os.File, error)
- func OverlayPath(path string) (string, bool)
- func ReadDir(dir string) ([]fs.FileInfo, error)
- func Stat(path string) (fs.FileInfo, error)
- func Walk(root string, walkFn filepath.WalkFunc) error
- type OverlayJSON
Constants ¶
This section is empty.
Variables ¶
var OverlayFile string
OverlayFile is the path to a text file in the OverlayJSON format. It is the value of the -overlay flag.
Functions ¶
func IsDirWithGoFiles ¶
IsDirWithGoFiles reports whether dir is a directory containing Go files either on disk or in the overlay.
func OverlayPath ¶
OverlayPath returns the path to the overlaid contents of the file, the empty string if the overlay deletes the file, or path itself if the file is not in the overlay, the file is a directory in the overlay, or there is no overlay. It returns true if the path is overlaid with a regular file or deleted, and false otherwise.
func ReadDir ¶
ReadDir provides a slice of fs.FileInfo entries corresponding to the overlaid files in the directory.
Types ¶
type OverlayJSON ¶
OverlayJSON is the format overlay files are expected to be in. The Replace map maps from overlaid paths to replacement paths: the Go command will forward all reads trying to open each overlaid path to its replacement path, or consider the overlaid path not to exist if the replacement path is empty.