-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.go
47 lines (39 loc) · 838 Bytes
/
util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
package main
import (
"fmt"
"os"
)
func Exists(dir string) bool {
_, err := os.Stat(dir)
return err == nil || !os.IsNotExist(err)
}
func Fatal(args ...interface{}) {
fmt.Fprintln(os.Stderr, args...)
panic("aborted")
}
func Fatalf(format string, args ...interface{}) {
fmt.Fprintf(os.Stderr, format, args...)
panic("aborted")
}
func ErrFatal(err error, args ...interface{}) {
if err == nil {
return
}
fmt.Fprintln(os.Stderr, args...)
panic("aborted")
}
func ErrFatalf(err error, format string, args ...interface{}) {
if err == nil {
return
}
fmt.Fprintf(os.Stderr, format, args...)
panic("aborted")
}
func Errf(err error, format string, args ...interface{}) {
if err == nil {
return
}
fmt.Fprintf(os.Stderr, format, args...)
}