os

package
Version: v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package os provides a platform-independent interface to operating system functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy added in v0.7.0

func Copy(dst, src string) error

Copy copies src content into dst. If dst doesn't exists, it will be created. src mode will override dst mode. Only file-file or directory-directory operations should be performed.

func CopyDir added in v0.7.0

func CopyDir(dst, src string, mode os.FileMode) error

CopyDir copies src content recursively into dst, if dst doesn't exists it will be created. mode will be the new dst mode, its content will preserve the origin mode.

func CopyFile added in v0.7.0

func CopyFile(dst, src string, mode os.FileMode) error

CopyFile copies src content into dst, if dst exists it will be truncated. mode will be the new dst mode.

func GetenvOr added in v0.8.0

func GetenvOr(key, val string) string

GetenvOr retrieves the value of the environment variable named by the key. If the variable is empty or absent, val will be used as the return value.

func NewCopyError added in v0.7.0

func NewCopyError(src, dst, msg string, err error) error

NewCopyError creates a CopyError.

Types

type CopyError added in v0.7.0

type CopyError struct {
	Src, Dst string
	Reason   string
	Err      error
}

CopyError records an error during a copy operation. If Err is nil, it means the error doesn't wrap any error from another package.

func (*CopyError) Error added in v0.7.0

func (e *CopyError) Error() string

Error implements the error interface.

func (*CopyError) Unwrap added in v0.7.0

func (e *CopyError) Unwrap() error

Unwrap allows to use functions from errors package over CopyError.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL