package lib
import "git.wntrmute.dev/kyle/goutils/lib"
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 )
Functions ¶
func Duration ¶
Duration returns a prettier string for time.Durations.
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.
func Warn ¶
Warn displays a formatted error message to standard output, appending the error string, à la warn(3).
func Warnx ¶
Warnx displays a formatted error message to standard error, à la warnx(3).
Types ¶
type FileTime ¶
FileTime contains the changed, modified, and accessed timestamps for a file.
func LoadFileTime ¶
LoadFileTime returns a FileTime associated with the file.
Source Files ¶
defs.go ftime_unix.go lib.go
- Version
- v1.7.7 (latest)
- Published
- Jun 15, 2024
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 4 days ago –
Tools for package owners.