initial commit
This commit is contained in:
28
utils.go
Normal file
28
utils.go
Normal file
@ -0,0 +1,28 @@
|
||||
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)
|
||||
}
|
Reference in New Issue
Block a user