os

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2025 License: MIT Imports: 5 Imported by: 2

Documentation

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

	DevNull = os.DevNull

	ModeAppend     = os.ModeAppend
	ModeCharDevice = os.ModeCharDevice
	ModeDevice     = os.ModeDevice
	ModeDir        = os.ModeDir
	ModeExclusive  = os.ModeExclusive
	ModeIrregular  = os.ModeIrregular
	ModeNamedPipe  = os.ModeNamedPipe
	ModePerm       = os.ModePerm
	ModeSetgid     = os.ModeSetgid
	ModeSetuid     = os.ModeSetuid
	ModeSocket     = os.ModeSocket
	ModeSticky     = os.ModeSticky
	ModeSymlink    = os.ModeSymlink
	ModeTemporary  = os.ModeTemporary
	ModeType       = os.ModeType
)

Variables

View Source
var (
	Args   = os.Args
	Stderr = os.Stderr
	Stdin  = os.Stdin
	Stdout = os.Stdout

	Chdir       = os.Chdir
	Clearenv    = os.Clearenv
	Environ     = os.Environ
	Executable  = os.Executable
	Exit        = os.Exit
	Expand      = os.Expand
	ExpandEnv   = os.ExpandEnv
	Getenv      = os.Getenv
	Getpagesize = os.Getpagesize
	Getegid     = os.Getegid
	Geteuid     = os.Geteuid
	Getgid      = os.Getgid
	Getuid      = os.Getuid
	Interrupt   = os.Interrupt

	ErrClosed           = os.ErrClosed
	ErrDeadlineExceeded = os.ErrDeadlineExceeded
	ErrExist            = os.ErrExist
	ErrInvalid          = os.ErrInvalid
	ErrNoDeadline       = os.ErrNoDeadline
	ErrNotExist         = os.ErrNotExist
	ErrPermission       = os.ErrPermission
	ErrProcessDone      = os.ErrProcessDone
	NewSyscallError     = os.NewSyscallError

	Chmod      = os.Chmod
	Chtimes    = os.Chtimes
	Create     = os.Create
	CreateTemp = os.CreateTemp
	DirFS      = os.DirFS
	CopyFS     = os.CopyFS
	Open       = os.Open
	OpenFile   = os.OpenFile
	Lchown     = os.Lchown
	Link       = os.Link
	Mkdir      = os.Mkdir
	MkdirAll   = os.MkdirAll
	NewFile    = os.NewFile
	Remove     = os.Remove
	RemoveAll  = os.RemoveAll
	Rename     = os.Rename
	Stat       = os.Stat
	Symlink    = os.Symlink
	Truncate   = os.Truncate
)
View Source
var System = sys{}

Functions

func WithContext

func WithContext(parent context.Context, val Os) context.Context

Types

type DirEntry

type DirEntry = os.DirEntry

type Ent added in v0.7.0

type Ent interface {
	Args() []string
	Executable() (string, error)
	Exit(code int)
}

type Env added in v0.7.0

type Env interface {
	Clearenv()
	Environ() []string
	ExpandEnv(s string) string
	Getenv(key string) string
	LookupEnv(key string) (string, bool)
	Setenv(key, value string) error
	Unsetenv(key string) error
	UserCacheDir() (string, error)
	UserConfigDir() (string, error)
	UserHomeDir() (string, error)
}

type File

type File = os.File

type FileInfo

type FileInfo = os.FileInfo

type FileMode

type FileMode = os.FileMode

type Fs added in v0.7.0

type Fs interface {
	CopyFS(dir string, fsys fs.FS) error
	DirFS(dir string) fs.FS
	Chdir(dir string) error
	Chmod(name string, mode FileMode) error
	Chown(name string, uid, gid int) error
	Chtimes(name string, atime, mtime time.Time) error
	Getwd() (string, error)
	IsPathSeparator(c uint8) bool
	Lchown(name string, uid, gid int) error
	Link(oldname, newname string) error
	Mkdir(name string, mode FileMode) error
	MkdirAll(path string, mode FileMode) error
	MkdirTemp(dir, pattern string) (string, error)
	Pipe() (r io.Reader, w io.Writer, err error)
	ReadDir(name string) ([]DirEntry, error)
	ReadFile(name string) ([]byte, error)
	Readlink(name string) (string, error)
	Remove(name string) error
	RemoveAll(path string) error
	Rename(oldpath, newpath string) error
	SameFile(fi1, fi2 FileInfo) bool
	Symlink(oldname, newname string) error
	TempDir() string
	Truncate(name string, size int64) error
	WriteFile(name string, data []byte, perm FileMode) error
}

type Id added in v0.7.0

type Id interface {
	Getegid() int
	Geteuid() int
	Getgid() int
	Getgroups() ([]int, error)
	Getuid() int
}

type LinkError

type LinkError = os.LinkError

type Net added in v0.7.0

type Net interface {
	Hostname() (name string, err error)
}

type Os

type Os interface {
	Ent
	Env
	Fs
	Id
	Net
	Stdio
	Sys
}

func FromContext

func FromContext(ctx context.Context) Os

type PathError

type PathError = os.PathError

type ProcAttr

type ProcAttr = os.ProcAttr

type Process

type Process = os.Process

type ProcessState

type ProcessState = os.ProcessState

type Root

type Root = os.Root

type Signal

type Signal = os.Signal

type Stdio added in v0.7.0

type Stdio interface {
	Stderr() io.Writer
	Stdin() io.Reader
	Stdout() io.Writer
}

type Sys added in v0.7.0

type Sys interface {
	Getpagesize() int
	Getpid() int
	Getppid() int
}

type SyscallError

type SyscallError = os.SyscallError

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL