Functions
Actual
function
#
Actual returns the actual file system path for the named file.
It returns the empty string if name has been deleted in the virtual file system.
func Actual(name string) string
Bind
function
#
Bind makes the virtual file system use dir as if it were mounted at mtpt,
like Plan 9's “bind” or Linux's “mount --bind”, or like os.Symlink
but without the symbolic link.
For now, the behavior of using Bind on multiple overlapping
mountpoints (for example Bind("x", "/a") and Bind("y", "/a/b"))
is undefined.
func Bind(dir string, mtpt string)
Glob
function
#
Glob is like filepath.Glob but uses the overlay file system.
func Glob(pattern string) (matches []string, err error)
Init
function
#
Init initializes the overlay, if one is being used.
func Init() error
IsDir
function
#
IsDir returns true if path is a directory on disk or in the
overlay.
func IsDir(path string) (bool, error)
IsDir
method
#
func (f fakeDir) IsDir() bool
IsDir
method
#
func (f missingFile) IsDir() bool
IsDir
method
#
func (f fakeFile) IsDir() bool
IsGoDir
function
#
IsGoDir reports whether the named directory in the virtual file system
is a directory containing one or more Go source files.
func IsGoDir(name string) (bool, error)
Lstat
function
#
Lstat returns a FileInfo describing the named file in the virtual file system.
It does not follow symbolic links
func Lstat(name string) (fs.FileInfo, error)
ModTime
method
#
func (f fakeDir) ModTime() time.Time
ModTime
method
#
func (f fakeFile) ModTime() time.Time
ModTime
method
#
func (f missingFile) ModTime() time.Time
Mode
method
#
func (f missingFile) Mode() fs.FileMode
Mode
method
#
func (f fakeFile) Mode() fs.FileMode
Mode
method
#
func (f fakeDir) Mode() fs.FileMode
Name
method
#
func (f fakeDir) Name() string
Name
method
#
func (f missingFile) Name() string
Name
method
#
func (f fakeFile) Name() string
Open
function
#
Open opens the named file in the virtual file system.
It must be an ordinary file, not a directory.
func Open(name string) (*os.File, error)
ReadDir
function
#
ReadDir reads the named directory in the virtual file system.
func ReadDir(name string) ([]fs.DirEntry, error)
ReadFile
function
#
ReadFile reads the named file from the virtual file system
and returns the contents.
func ReadFile(name string) ([]byte, error)
Replaced
function
#
Replaced reports whether the named file has been modified
in the virtual file system compared to the OS file system.
func Replaced(name string) bool
Size
method
#
func (f fakeFile) Size() int64
Size
method
#
func (f fakeDir) Size() int64
Size
method
#
func (f missingFile) Size() int64
Stat
function
#
Stat returns a FileInfo describing the named file in the virtual file system.
It follows symbolic links.
func Stat(name string) (fs.FileInfo, error)
String
method
#
func (f fakeDir) String() string
String
method
#
func (f fakeFile) String() string
String
method
#
func (f missingFile) String() string
Sys
method
#
func (f missingFile) Sys() any
Sys
method
#
func (f fakeDir) Sys() any
Sys
method
#
func (f fakeFile) Sys() any
Trace
function
#
Trace emits a trace event for the operation and file path to the trace log,
but only when $GODEBUG contains gofsystrace=1.
The traces are appended to the file named by the $GODEBUG setting gofsystracelog, or else standard error.
For debugging, if the $GODEBUG setting gofsystracestack is non-empty, then trace events for paths
matching that glob pattern (using path.Match) will be followed by a full stack trace.
func Trace(op string, path string)
WalkDir
function
#
WalkDir is like filepath.WalkDir but over the virtual file system.
func WalkDir(root string, fn fs.WalkDirFunc) error
abs
function
#
abs returns the absolute form of path, for looking up in the overlay map.
For the most part, this is filepath.Abs and filepath.Clean,
except that Windows requires special handling, as always.
func abs(path string) string
children
method
#
children returns a sequence of (name, info)
for all the children of the directory i
implied by the overlay.
func (i *info) children() *ast.IndexListExpr
cleanGlobPath
function
#
cleanGlobPath prepares path for glob matching.
func cleanGlobPath(path string) string
cleanGlobPathWindows
function
#
cleanGlobPathWindows is windows version of cleanGlobPath.
func cleanGlobPathWindows(path string) (prefixLen int, cleaned string)
cmp
function
#
func cmp(x string, y string) int
cwdOnce
function
#
func cwdOnce() string
glob
function
#
glob searches for files matching pattern in the directory dir
and appends them to matches. If the directory cannot be
opened, it returns the existing matches. New matches are
added in lexicographical order.
func glob(dir string, pattern string, matches []string) (m []string, e error)
hasMeta
function
#
hasMeta reports whether path contains any of the magic characters
recognized by filepath.Match.
func hasMeta(path string) bool
init
function
#
func init()
initFromJSON
function
#
func initFromJSON(js []byte) error
osReadDir
function
#
osReadDir is like os.ReadDir corrects the error to be errNotDir
if the problem is that name exists but is not a directory.
func osReadDir(name string) ([]fs.DirEntry, error)
overlayStat
function
#
overlayStat implements lstat or Stat (depending on whether os.Lstat or os.Stat is passed in).
func overlayStat(op string, path string, osStat func(string) (fs.FileInfo, error)) (fs.FileInfo, error)
searchcmp
function
#
func searchcmp(r replace, t string) int
stat
function
#
stat returns info about the path in the virtual file system.
func stat(path string) info
volumeNameLen
function
#
func volumeNameLen(path string) int
walkDir
function
#
walkDir recursively descends path, calling walkDirFn.
func walkDir(path string, d fs.DirEntry, walkDirFn fs.WalkDirFunc) error