aboutsummaryrefslogtreecommitdiff
path: root/bolt.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-02-28 15:13:00 -0700
committerBen Johnson <benbjohnson@yahoo.com>2014-02-28 15:13:07 -0700
commit956453b69fd8ba9a356edcf81597d90d769311b2 (patch)
treee6767873d45061d0ca2f4c3f35b235febe2b922e /bolt.go
parentAdd bucket reclamation. (diff)
downloaddedo-956453b69fd8ba9a356edcf81597d90d769311b2.tar.gz
dedo-956453b69fd8ba9a356edcf81597d90d769311b2.tar.xz
Minor refactor.
Diffstat (limited to 'bolt.go')
-rw-r--r--bolt.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/bolt.go b/bolt.go
index bb5a2de..f258731 100644
--- a/bolt.go
+++ b/bolt.go
@@ -1,6 +1,7 @@
package bolt
import (
+ "fmt"
"os"
)
@@ -13,3 +14,18 @@ func Open(path string, mode os.FileMode) (*DB, error) {
}
return db, nil
}
+
+// _assert will panic with a given formatted message if the given condition is false.
+func _assert(condition bool, msg string, v ...interface{}) {
+ if !condition {
+ panic(fmt.Sprintf("assertion failed: "+msg, v...))
+ }
+}
+
+func warn(v ...interface{}) {
+ fmt.Fprintln(os.Stderr, v...)
+}
+
+func warnf(msg string, v ...interface{}) {
+ fmt.Fprintf(os.Stderr, msg+"\n", v...)
+}