adverr/utils.go

29 lines
636 B
Go

package adverr
import (
"fmt"
"os"
)
// Println prints the given err to stderr followed by a newline
func Println(err error) {
fmt.Fprintln(os.Stderr, err)
}
// Print prints the given err to stderr
func Print(err error) {
fmt.Fprint(os.Stderr, err)
}
// Fatalln prints the given err to stderr followed by a newline and exits immediately with the given exit code
func Fatalln(err error, exitcode int) {
fmt.Fprintln(os.Stderr, err)
os.Exit(exitcode)
}
// Fatal prints the given err to stderr and exits immediately with the given exit code
func Fatal(err error, exitcode int) {
fmt.Fprint(os.Stderr, err)
os.Exit(exitcode)
}