summaryrefslogtreecommitdiff
path: root/util.go
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-05-25 17:01:18 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-05-25 17:01:18 -0400
commit59534fb9e357b08df47a6923f036090e82017396 (patch)
tree4ef013a346befee2771e4ef1f9045c3530ea5340 /util.go
parent0fe6ab91df7158cacd5c2a632d36066251a292c4 (diff)
Add tests for urls
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)