Documentation ¶
Index ¶
- Variables
- func BackupAndCleanDir(dir string) error
- func Exit(code int, msg string)
- func ExpandDir(dir string) string
- func IsDirEmpty(name string) bool
- func MkdirAll(path string) error
- func NormalizeZapLogPath(path string) string
- func NotifySignal(c chan<- Signal, sig ...Signal) error
- func RaiseSignal(pid int, sig Signal) error
- func RemoveAll(path string) error
- func ValidateName(name string) error
- type Signal
Constants ¶
This section is empty.
Variables ¶
var URLFriendlyCharactersRegex = regexp.MustCompile(`^[A-Za-z0-9\-_\.~]{1,253}$`)
URLFriendlyCharactersRegex - safe characters for friendly url, rfc3986 section 2.3
Functions ¶
func BackupAndCleanDir ¶
BackupAndCleanDir cleans old stuff in both dir and backupDir, and backups dir to backupDir. The backupDir generated by appending postfix `_bak` for dir. It does nothing if dir does not exist.
func ExpandDir ¶
ExpandDir cleans the dir, and returns itself if it's absolute, otherwise prefix with the current/working directory.
func IsDirEmpty ¶
IsDirEmpty returns true if a directory is empty.
func NormalizeZapLogPath ¶ added in v1.2.0
NormalizeZapLogPath is a workaround for https://github.com/uber-go/zap/issues/621 the workaround is from https://github.com/ipfs/go-log/issues/73
func NotifySignal ¶ added in v1.2.0
NotifySignal is identical to os/signal.Notify on Linux param is mapped to abstract Signal and nil is not allowed
func RaiseSignal ¶ added in v1.2.0
RaiseSignal is identical to syscall.Kill on Linux param is mapped to abstract Signal
any chan passed to NotifySignal will receive the sig