os

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDirPerm  = 0770
	DefaultFilePerm = 0660
)

Variables

This section is empty.

Functions

func EnsureDir

func EnsureDir(dirPath string, perm os.FileMode) error

EnsureDir creates a directory if it does not exist.

func EnsureFileDir

func EnsureFileDir(filePath string, perm os.FileMode) error

EndureFileDir creates a file's directory if it does not exist.

func PathExists

func PathExists(path string) bool

PathExists indicates if a path exists.

func RemovePathIfExists

func RemovePathIfExists(path string) error

RemovePathIfExists removes a directory or a file if it exists.

func TrapSignal

func TrapSignal(logger log.Logger, stopper Stopper)

TrapSignal listens os signals SIGINT and SIGTERM in a goroutine. If trapped once, the stopper's Stop method is called to cleanup. If trapped twice, the program is interrupted.

Types

type Stopper

type Stopper interface {
	Stop() error
	IsRunning() bool
}

Stopper interface defines the methods a concrete stopper must implement.

Jump to

Keyboard shortcuts

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