diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-28 15:13:00 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-28 15:13:07 -0700 |
commit | 956453b69fd8ba9a356edcf81597d90d769311b2 (patch) | |
tree | e6767873d45061d0ca2f4c3f35b235febe2b922e /bolt.go | |
parent | Add bucket reclamation. (diff) | |
download | dedo-956453b69fd8ba9a356edcf81597d90d769311b2.tar.gz dedo-956453b69fd8ba9a356edcf81597d90d769311b2.tar.xz |
Minor refactor.
Diffstat (limited to 'bolt.go')
-rw-r--r-- | bolt.go | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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...) +} |