summaryrefslogtreecommitdiff
path: root/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'util.go')
-rw-r--r--util.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/util.go b/util.go
index 1871156d3..5878d87b9 100644
--- a/util.go
+++ b/util.go
@@ -13,6 +13,18 @@ func logDebug(format string, v ...interface{}) {
}
}
+// exists returns whether the given file or directory exists or not
+func exists(path string) bool {
+ _, err := os.Stat(path)
+ if err == nil {
+ return true
+ }
+ if os.IsNotExist(err) {
+ return false
+ }
+ panic(err)
+}
+
func assert(cond bool, msg string) {
if !cond {
panic(msg)