Documentation ¶
Index ¶
- Variables
- func DisableSymlinks()
- type BasicFilesystem
- func (BasicFilesystem) ChangeSymlinkType(_ string, _ LinkTargetType) error
- func (f *BasicFilesystem) Chmod(name string, mode FileMode) error
- func (f *BasicFilesystem) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (f *BasicFilesystem) Create(name string) (File, error)
- func (BasicFilesystem) CreateSymlink(name, target string, _ LinkTargetType) error
- func (f *BasicFilesystem) DirNames(name string) ([]string, error)
- func (f *BasicFilesystem) Lstat(name string) (FileInfo, error)
- func (f *BasicFilesystem) Mkdir(name string, perm FileMode) error
- func (f *BasicFilesystem) Open(name string) (File, error)
- func (BasicFilesystem) ReadSymlink(path string) (string, LinkTargetType, error)
- func (f *BasicFilesystem) Remove(name string) error
- func (f *BasicFilesystem) Rename(oldpath, newpath string) error
- func (f *BasicFilesystem) Stat(name string) (FileInfo, error)
- func (BasicFilesystem) SymlinksSupported() bool
- func (f *BasicFilesystem) Walk(root string, walkFn WalkFunc) error
- type File
- type FileInfo
- type FileMode
- type Filesystem
- type LinkTargetType
- type MtimeFS
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
var SkipDir = errSkipDir // silences the lint warning...
Functions ¶
func DisableSymlinks ¶ added in v0.14.13
func DisableSymlinks()
Types ¶
type BasicFilesystem ¶ added in v0.14.13
type BasicFilesystem struct { }
The BasicFilesystem implements all aspects by delegating to package os.
func NewBasicFilesystem ¶ added in v0.14.13
func NewBasicFilesystem() *BasicFilesystem
func (BasicFilesystem) ChangeSymlinkType ¶ added in v0.14.13
func (BasicFilesystem) ChangeSymlinkType(_ string, _ LinkTargetType) error
func (*BasicFilesystem) Chmod ¶ added in v0.14.13
func (f *BasicFilesystem) Chmod(name string, mode FileMode) error
func (*BasicFilesystem) Create ¶ added in v0.14.13
func (f *BasicFilesystem) Create(name string) (File, error)
func (BasicFilesystem) CreateSymlink ¶ added in v0.14.13
func (BasicFilesystem) CreateSymlink(name, target string, _ LinkTargetType) error
func (*BasicFilesystem) DirNames ¶ added in v0.14.13
func (f *BasicFilesystem) DirNames(name string) ([]string, error)
func (*BasicFilesystem) Lstat ¶ added in v0.14.13
func (f *BasicFilesystem) Lstat(name string) (FileInfo, error)
func (*BasicFilesystem) Mkdir ¶ added in v0.14.13
func (f *BasicFilesystem) Mkdir(name string, perm FileMode) error
func (*BasicFilesystem) Open ¶ added in v0.14.13
func (f *BasicFilesystem) Open(name string) (File, error)
func (BasicFilesystem) ReadSymlink ¶ added in v0.14.13
func (BasicFilesystem) ReadSymlink(path string) (string, LinkTargetType, error)
func (*BasicFilesystem) Remove ¶ added in v0.14.13
func (f *BasicFilesystem) Remove(name string) error
func (*BasicFilesystem) Rename ¶ added in v0.14.13
func (f *BasicFilesystem) Rename(oldpath, newpath string) error
func (*BasicFilesystem) Stat ¶ added in v0.14.13
func (f *BasicFilesystem) Stat(name string) (FileInfo, error)
func (BasicFilesystem) SymlinksSupported ¶ added in v0.14.13
func (BasicFilesystem) SymlinksSupported() bool
func (*BasicFilesystem) Walk ¶ added in v0.14.13
func (f *BasicFilesystem) Walk(root string, walkFn WalkFunc) error
Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk does not follow symbolic links.
type File ¶ added in v0.14.13
The File interface abstracts access to a regular file, being a somewhat smaller interface than os.File
type FileInfo ¶ added in v0.14.13
type FileInfo interface { // Standard things present in os.FileInfo Name() string Mode() FileMode Size() int64 ModTime() time.Time IsDir() bool // Extensions IsRegular() bool IsSymlink() bool }
The FileInfo interface is almost the same as os.FileInfo, but with the Sys method removed (as we don't want to expose whatever is underlying) and with a couple of convenience methods added.
type Filesystem ¶ added in v0.14.13
type Filesystem interface { ChangeSymlinkType(name string, tt LinkTargetType) error Chmod(name string, mode FileMode) error Chtimes(name string, atime time.Time, mtime time.Time) error Create(name string) (File, error) CreateSymlink(name, target string, tt LinkTargetType) error DirNames(name string) ([]string, error) Lstat(name string) (FileInfo, error) Mkdir(name string, perm FileMode) error Open(name string) (File, error) ReadSymlink(name string) (string, LinkTargetType, error) Remove(name string) error Rename(oldname, newname string) error Stat(name string) (FileInfo, error) SymlinksSupported() bool Walk(root string, walkFn WalkFunc) error }
The Filesystem interface abstracts access to the file system.
var DefaultFilesystem Filesystem = new(BasicFilesystem)
DefaultFilesystem is the fallback to use when nothing explicitly has been passed.
type LinkTargetType ¶ added in v0.14.13
type LinkTargetType int
const ( LinkTargetFile LinkTargetType = iota LinkTargetDirectory LinkTargetUnknown )
type MtimeFS ¶
type MtimeFS struct {
// contains filtered or unexported fields
}
The MtimeFS is a filesystem with nanosecond mtime precision, regardless of what shenanigans the underlying filesystem gets up to.
func NewMtimeFS ¶
func NewMtimeFS(db database) *MtimeFS
type WalkFunc ¶ added in v0.14.13
WalkFunc is the type of the function called for each file or directory visited by Walk. The path argument contains the argument to Walk as a prefix; that is, if Walk is called with "dir", which is a directory containing the file "a", the walk function will be called with argument "dir/a". The info argument is the FileInfo for the named path.
If there was a problem walking to the file or directory named by path, the incoming error will describe the problem and the function can decide how to handle that error (and Walk will not descend into that directory). If an error is returned, processing stops. The sole exception is when the function returns the special value SkipDir. If the function returns SkipDir when invoked on a directory, Walk skips the directory's contents entirely. If the function returns SkipDir when invoked on a non-directory file, Walk skips the remaining files in the containing directory.