Documentation ¶
Overview ¶
Package lib contains functions useful for most programs.
Index ¶
- Constants
- func Duration(d time.Duration) string
- func Err(exit int, err error, format string, a ...interface{})
- func Errx(exit int, format string, a ...interface{})
- func Itoa(i int, wid int) string
- func ProgName() string
- func Warn(err error, format string, a ...interface{}) (int, error)
- func Warnx(format string, a ...interface{}) (int, error)
- type FileTime
Constants ¶
const ( // ExitSuccess is the successful exit status. // // It should be called on successful exit. ExitSuccess = 0 // ExitFailure is the failing exit status. ExitFailure = 1 )
Variables ¶
This section is empty.
Functions ¶
func Err ¶
Err displays a formatting error message to standard error, appending the error string, and exits with the status code from `exit`, à la err(3).
func Errx ¶
Errx displays a formatted error message to standard error and exits with the status code from `exit`, à la errx(3).
func Itoa ¶
Itoa provides cheap integer to fixed-width decimal ASCII. Give a negative width to avoid zero-padding. Adapted from the 'itoa' function in the log/log.go file in the standard library.
func ProgName ¶
func ProgName() string
ProgName returns what lib thinks the program name is, namely the basename of of argv0.
It is similar to the Linux __progname function.
Types ¶
type FileTime ¶
FileTime contains the changed, modified, and accessed timestamps for a file.
func LoadFileTime ¶
LoadFileTime returns a FileTime associated with the file.