Documentation
¶
Overview ¶
Package fsys implements a virtual file system that the go command uses to read source file trees. The virtual file system redirects some OS file paths to other OS file paths, according to an overlay file. Editors can use this overlay support to invoke the go command on temporary files that have been edited but not yet saved into their final locations.
Index ¶
- Variables
- func Actual(name string) string
- func Bind(dir, mtpt string)
- func Glob(pattern string) (matches []string, err error)
- func Init() error
- func IsDir(path string) (bool, error)
- func IsGoDir(name string) (bool, error)
- func Lstat(name string) (fs.FileInfo, error)
- func Open(name string) (*os.File, error)
- func ReadDir(name string) ([]fs.DirEntry, error)
- func ReadFile(name string) ([]byte, error)
- func Replaced(name string) bool
- func Stat(name string) (fs.FileInfo, error)
- func Trace(op, path string)
- func WalkDir(root string, fn fs.WalkDirFunc) error
Constants ¶
This section is empty.
Variables ¶
var OverlayFile string
OverlayFile is the -overlay flag value. It names a file containing the JSON for an overlayJSON struct.
Functions ¶
func Actual ¶ added in go1.24.0
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 Bind ¶ added in go1.24.0
func Bind(dir, mtpt string)
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 IsGoDir ¶ added in go1.24.0
IsGoDir reports whether the named directory in the virtual file system is a directory containing one or more Go source files.
func Lstat ¶
Lstat returns a FileInfo describing the named file in the virtual file system. It does not follow symbolic links
func Open ¶
Open opens the named file in the virtual file system. It must be an ordinary file, not a directory.
func ReadFile ¶ added in go1.23.0
ReadFile reads the named file from the virtual file system and returns the contents.
func Replaced ¶ added in go1.24.0
Replaced reports whether the named file has been modified in the virtual file system compared to the OS file system.
func Stat ¶
Stat returns a FileInfo describing the named file in the virtual file system. It follows symbolic links.
func Trace ¶ added in go1.19
func Trace(op, path string)
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.
Types ¶
This section is empty.