Documentation
¶
Overview ¶
Package os provides additional OS abstraction functionality for functions not provided by the Go standard library.
Index ¶
- Variables
- func CacheDir() string
- func CacheFilename(filename string) string
- func GetExitCode(exitErr error) (exitCode int, err error)
- func GetFileGID(fi os.FileInfo) (int, error)
- func GetFileUID(fi os.FileInfo) (int, error)
- func IsNotEmpty(err error) bool
- func OpenFileNoSymlinks(path string, flags int, mode os.FileMode) (*os.File, error)
- func OpenNoSymlinks(path string) (*os.File, error)
- func RemoveEmpty(path string) error
Constants ¶
This section is empty.
Variables ¶
var ErrNotEmpty = errors.New("directory not empty")
Functions ¶
func CacheDir ¶
func CacheDir() string
Returns a directory suitable for storing cached data.
On Windows, this is the 'local' appdata directory. On *NIX, it is XDG_CACHE_DIR (or failing that, $HOME/.cache).
Returns "" if suitable path cannot be identified.
func CacheFilename ¶
Returns a filename under the directory returned by CacheDir.
func GetExitCode ¶
Given an error, determines if that error is an os/exec ExitError. If it is, and the platform is supported, returns the exitCode and nil error. Otherwise, passes through the error, and exitCode is undefined.
func IsNotEmpty ¶
Returns true if the error is ErrNotEmpty or the underlying POSIX error code error is ENOTEMPTY. Currently always returns false on Windows.
func OpenFileNoSymlinks ¶
Opens a file but does not follow symlinks.
func RemoveEmpty ¶
Delete a tree of empty directories. Returns non-nil error if an empty directory cannot be deleted. Does not return an error if there are non-empty directories. This function can be used to prune empty directories from a tree.
Types ¶
This section is empty.