os

package
v0.2.196 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SEEK_SET int = os.SEEK_SET //= 0 // seek relative to the origin of the file
	SEEK_CUR int = os.SEEK_CUR // 1 // seek relative to the current offset
	SEEK_END int = os.SEEK_END
)
View Source
const (
	// Exactly one of O_RDONLY, O_WRONLY, or O_RDWR must be specified.
	O_RDONLY int = os.O_RDONLY //syscall.O_RDONLY // open the file read-only.
	O_WRONLY int = os.O_WRONLY // syscall.O_WRONLY // open the file write-only.
	O_RDWR   int = os.O_RDWR   //syscall.O_RDWR   // open the file read-write.
	// The remaining values may be or'ed in to control behavior.
	O_APPEND int = os.O_APPEND //syscall.O_APPEND // append data to the file when writing.
	O_CREATE int = os.O_CREATE //syscall.O_CREAT  // create a new file if none exists.
	O_EXCL   int = os.O_EXCL   //syscall.O_EXCL   // used with O_CREATE, file must not exist.
	O_SYNC   int = os.O_SYNC   //syscall.O_SYNC   // open for synchronous I/O.
	O_TRUNC  int = os.O_TRUNC  //syscall.O_TRUNC  // truncate regular writable file when opened.
)
View Source
const (
	ModeSymlink = os.ModeSymlink
	ModeSetgid  = os.ModeSetgid
	ModeType    = os.ModeType
)
View Source
const DevNull = os.DevNull
View Source
const PathListSeparator = os.PathListSeparator
View Source
const PathSeparator = os.PathSeparator

Variables

View Source
var (
	Stdin  = os.Stdin
	Stdout = os.Stdout
	Stderr = os.Stderr
)
View Source
var Args []string = os.Args
View Source
var ErrClosed = os.ErrClosed
View Source
var ErrNotExist = os.ErrNotExist
View Source
var Interrupt = os.Interrupt

Functions

func Chdir

func Chdir(dir string) error

func Chmod

func Chmod(name string, mode FileMode) error

func Chtimes

func Chtimes(name string, atime time.Time, mtime time.Time) error

func Environ

func Environ() []string

func Executable

func Executable() (string, error)

func Exit

func Exit(code int)

func Expand

func Expand(s string, mapping func(string) string) string

func ExpandEnv

func ExpandEnv(s string) string

func Getenv

func Getenv(key string) string

func Getpagesize

func Getpagesize() int

func Getpid

func Getpid() int

func Getuid

func Getuid() int

func Getwd

func Getwd() (dir string, err error)

func IsExist

func IsExist(err error) bool

func IsNotExist

func IsNotExist(err error) bool

func IsPathSeparator

func IsPathSeparator(c uint8) bool

func IsPermission

func IsPermission(err error) bool

func LookupEnv

func LookupEnv(key string) (string, bool)

func Mkdir

func Mkdir(name string, perm FileMode) error

func MkdirAll

func MkdirAll(path string, perm FileMode) error

func MkdirTemp

func MkdirTemp(dir, pattern string) (string, error)

func ReadDir

func ReadDir(name string) ([]fs.DirEntry, error)

func ReadFile

func ReadFile(name string) ([]byte, error)

ReadFile reads the named file and returns the contents. A successful call returns err == nil, not err == EOF. Because ReadFile reads the whole file, it does not treat an EOF from Read as an error to be reported.

func Readlink(name string) (string, error)

func Remove

func Remove(name string) error

func RemoveAll

func RemoveAll(path string) error

func Rename

func Rename(oldpath, newpath string) error

func SameFile

func SameFile(fi1, fi2 FileInfo) bool

func Setenv

func Setenv(key, value string) error
func Symlink(oldname, newname string) error

func TempDir

func TempDir() string

func UserCacheDir

func UserCacheDir() (string, error)

func UserConfigDir

func UserConfigDir() (string, error)

func UserHomeDir

func UserHomeDir() (string, error)

func WriteFile

func WriteFile(name string, data []byte, perm FileMode) error

Types

type File

type File struct {
	// contains filtered or unexported fields
}

func Create

func Create(name string) (*File, error)

func CreateTemp

func CreateTemp(dir, pattern string) (*File, error)

func Open

func Open(name string) (*File, error)

func OpenFile

func OpenFile(name string, flag int, perm FileMode) (*File, error)

func StderrFileObject

func StderrFileObject() *File

special case for src/cmd/gocmd/internal/fsys/fsys.go

func Wrap

func Wrap(f *os.File, err error) (*File, error)

for ioutil:

func (File) Chmod

func (f File) Chmod(mode FileMode) error

func (File) Close

func (f File) Close() error

func (File) Fd

func (f File) Fd() uintptr

func (File) Getosfile

func (f File) Getosfile() *os.File

special case for src/cmd/cgo/out.go

func (File) Name

func (f File) Name() string

func (File) Read

func (f File) Read(b []byte) (n int, err error)

/-------------

func (File) ReadAt

func (f File) ReadAt(b []byte, off int64) (n int, err error)

func (File) ReadDir

func (f File) ReadDir(n int) ([]fs.DirEntry, error)

func (File) Readdirnames

func (f File) Readdirnames(n int) (names []string, err error)

func (File) Seek

func (f File) Seek(offset int64, whence int) (ret int64, err error)

func (File) Stat

func (f File) Stat() (FileInfo, error)

func (File) Sync

func (f File) Sync() error

func (File) Truncate

func (f File) Truncate(size int64) error

func (File) Write

func (f File) Write(b []byte) (n int, err error)

func (File) WriteAt

func (f File) WriteAt(b []byte, off int64) (n int, err error)

func (File) WriteString

func (f File) WriteString(s string) (n int, err error)

type FileInfo

type FileInfo = os.FileInfo

func Lstat

func Lstat(name string) (FileInfo, error)

func Stat

func Stat(name string) (FileInfo, error)

type FileMode

type FileMode = os.FileMode
const ModePerm FileMode = os.ModePerm

type LinkError

type LinkError = os.LinkError

type PathError

type PathError = os.PathError

type Signal

type Signal = os.Signal

type SyscallError

type SyscallError = os.SyscallError

Jump to

Keyboard shortcuts

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