diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-05-25 17:01:18 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-05-25 17:01:18 -0400 |
commit | 59534fb9e357b08df47a6923f036090e82017396 (patch) | |
tree | 4ef013a346befee2771e4ef1f9045c3530ea5340 /util.go | |
parent | 0fe6ab91df7158cacd5c2a632d36066251a292c4 (diff) |
Add tests for urls
Diffstat (limited to 'util.go')
-rw-r--r-- | util.go | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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) |