Documentation
¶
Overview ¶
This package provides an interface to functions and structs in the standard io/fs package to facilitate mocking.
Index ¶
- Constants
- Variables
- func NewDirEntry(de fs.DirEntry) dirEntryFacade
- func NewFileMode(fm fs.FileMode) fileModeFacade
- func NewFileSystem() fileSystemFacade
- type DirEntry
- type FS
- type File
- type FileInfo
- type FileMode
- type FileSystem
- type GlobFS
- type PathError
- type ReadDirFS
- type ReadDirFile
- type ReadFileFS
- type StatFS
- type SubFS
- type WalkDirFunc
Constants ¶
View Source
const ( ModeRegular fs.FileMode = 0 ModeDir = fs.ModeDir ModeAppend = fs.ModeAppend ModeExclusive = fs.ModeExclusive ModeTemporary = fs.ModeTemporary ModeSymlink = fs.ModeSymlink ModeDevice = fs.ModeDevice ModeNamedPipe = fs.ModeNamedPipe ModeSocket = fs.ModeSocket ModeSetuid = fs.ModeSetuid ModeSetgid = fs.ModeSetgid ModeCharDevice = fs.ModeCharDevice ModeSticky = fs.ModeSticky ModeIrregular = fs.ModeIrregular ModeType = fs.ModeType ModePerm = fs.ModePerm )
Variables ¶
View Source
var ( ErrInvalid = fs.ErrInvalid ErrPermission = fs.ErrPermission ErrExist = fs.ErrExist ErrNotExist = fs.ErrNotExist ErrClosed = fs.ErrClosed SkipAll = fs.SkipAll SkipDir = fs.SkipDir )
Functions ¶
func NewDirEntry ¶ added in v0.1.6
func NewFileMode ¶ added in v0.1.7
func NewFileSystem ¶
func NewFileSystem() fileSystemFacade
Types ¶
type DirEntry ¶
type DirEntry interface {
// Access to members variables:
Name() string
IsDir() bool
Type() fs.FileMode
Info() (fs.FileInfo, error)
Format() string
}
func ToDirEntryList ¶ added in v0.1.6
type FileMode ¶
type FileMode interface {
IsRegular() bool
IsDir() bool
IsAppend() bool
IsExclusive() bool
IsTemporary() bool
IsSymlink() bool
IsDevice() bool
IsNamedPipe() bool
IsSocket() bool
IsSetuid() bool
IsSetgid() bool
IsCharDevice() bool
IsSticky() bool
IsIrregular() bool
Perm() FileMode
String() string
Type() FileMode
}
type FileSystem ¶
type FileSystem interface {
FormatDirEntry(DirEntry) string
FormatFileInfo(FileInfo) string
Glob(FileSystem, string) ([]string, error)
ReadFile(FileSystem, string) ([]byte, error)
ValidPath(string) bool
WalkDir(FileSystem, string, WalkDirFunc) error
// Constructors
FileInfoToDirEntry(FileInfo) DirEntry
ReadDir(FileSystem, string) ([]DirEntry, error)
Sub(FileSystem, string) (FileSystem, error)
Stat(FileSystem, string) (FileInfo, error)
}
The FileSystem interface provides access to all the functions and structs in the io/fs package. It is renamed to FileSystem, instead of FS, because the io/fs package already contains an interface named FS.
type ReadDirFile ¶
type ReadDirFile = fs.ReadDirFile
type ReadFileFS ¶
type ReadFileFS = fs.ReadFileFS
type WalkDirFunc ¶
type WalkDirFunc = fs.WalkDirFunc
Click to show internal directories.
Click to hide internal directories.