Documentation
¶
Overview ¶
This package provides an interface to functions and structs in the standard os package to facilitate mocking.
Index ¶
Constants ¶
View Source
const ( O_RDONLY = os.O_RDONLY O_WRONLY = os.O_WRONLY O_RDWR = os.O_RDWR O_APPEND = os.O_APPEND O_CREATE = os.O_CREATE O_EXCL = os.O_EXCL O_SYNC = os.O_SYNC O_TRUNC = os.O_TRUNC SEEK_SET = os.SEEK_SET SEEK_CUR = os.SEEK_CUR SEEK_END = os.SEEK_END PathSeparator = os.PathSeparator PathListSeparator = os.PathListSeparator ModeFile = FileMode(0) ModeDir = os.ModeDir ModeAppend = os.ModeAppend ModeExclusive = os.ModeExclusive ModeTemporary = os.ModeTemporary ModeSymlink = os.ModeSymlink ModeDevice = os.ModeDevice ModeNamedPipe = os.ModeNamedPipe ModeSocket = os.ModeSocket ModeSetuid = os.ModeSetuid ModeSetgid = os.ModeSetgid ModeCharDevice = os.ModeCharDevice ModeSticky = os.ModeSticky ModeIrregular = os.ModeIrregular ModeType = os.ModeType ModePerm = os.ModePerm DevNull = os.DevNull )
Variables ¶
View Source
var ( ErrInvalid = os.ErrInvalid ErrPermission = os.ErrPermission ErrExist = os.ErrExist ErrNotExist = os.ErrNotExist ErrClosed = os.ErrClosed ErrNoDeadline = os.ErrNoDeadline ErrDeadlineExceeded = os.ErrDeadlineExceeded ErrProcessDone = os.ErrProcessDone )
Functions ¶
This section is empty.
Types ¶
type File ¶
type File interface {
Chdir() error
Chmod(FileMode) error
Chown(int, int) error
Close() error
Fd() uintptr
Name() string
Read([]byte) (int, error)
ReadAt([]byte, int64) (int, error)
ReadDir(int) ([]DirEntry, error)
ReadFrom(io.Reader) (int64, error)
Readdir(int) ([]FileInfo, error)
Readdirnames(int) ([]string, error)
Seek(int64, int) (int64, error)
SetDeadline(time.Time) error
SetReadDeadline(time.Time) error
SetWriteDeadline(time.Time) error
Stat() (FileInfo, error)
Sync() error
SyscallConn() (syscall.RawConn, error)
Truncate(int64) error
Write([]byte) (int, error)
WriteAt([]byte, int64) (int, error)
WriteString(string) (int, error)
WriteTo(io.Writer) (int64, error)
}
type OS ¶
type OS interface {
// Access to global variables:
Stdin() File
Stderr() File
Stdout() File
Args() []string
// Functions:
Chdir(string) error
Chmod(string, FileMode) error
Chown(string, int, int) error
Chtimes(string, time.Time, time.Time) error
Clearenv()
CopyFS(string, fs.FS) error
DirFS(string) fs.FS
Environ() []string
Executable() (string, error)
Exit(int)
Expand(string, func(string) string) string
ExpandEnv(string) string
Getegid() int
Getenv(string) string
Geteuid() int
Getgid() int
Getgroups() ([]int, error)
Getpagesize() int
Getpid() int
Getppid() int
Getuid() int
Getwd() (string, error)
Hostname() (string, error)
IsExist(error) bool // Deprecated
IsNotExist(error) bool // Deprecated
IsPathSeparator(uint8) bool
IsPermission(error) bool // Deprecated
IsTimeout(error) bool // Deprecated
Lchown(string, int, int) error
Link(string, string) error
LookupEnv(string) (string, bool)
Mkdir(string, FileMode) error
MkdirAll(string, FileMode) error
MkdirTemp(string, string) (string, error)
NewSyscallError(string, error) error
Pipe() (File, File, error)
ReadFile(string) ([]byte, error)
Readlink(string) (string, error)
Remove(string) error
RemoveAll(string) error
Rename(string, string) error
SameFile(FileInfo, FileInfo) bool
Setenv(string, string) error
Symlink(string, string) error
TempDir() string
Truncate(string, int64) error
Unsetenv(string) error
UserCacheDir() (string, error)
UserConfigDir() (string, error)
UserHomeDir() (string, error)
WriteFile(string, []byte, FileMode) error
// DirEntry constructors
ReadDir(string) ([]DirEntry, error)
// File constructors
Create(string) (File, error)
CreateTemp(string, string) (File, error)
NewFile(uintptr, string) File
Open(string) (File, error)
OpenFile(string, int, FileMode) (File, error)
OpenInRoot(string, string) (File, error)
// FileInfo constructors
Lstat(string) (FileInfo, error)
Stat(string) (FileInfo, error)
// Process constructors
FindProcess(int) (Process, error)
StartProcess(string, []string, *ProcAttr) (Process, error)
// Root constructors
OpenRoot(string) (Root, error)
}
type ProcessState ¶
type ProcessState = os.ProcessState
type Root ¶
type Root interface {
Close() error
Create(string) (File, error)
FS() fs.FS
Lstat(string) (FileInfo, error)
Mkdir(string, FileMode) error
Name() string
Open(string) (File, error)
OpenFile(string, int, FileMode) (File, error)
OpenRoot(string) (Root, error)
Remove(string) error
Stat(string) (FileInfo, error)
}
type SyscallError ¶
type SyscallError = os.SyscallError
Click to show internal directories.
Click to hide internal directories.