aboutsummaryrefslogtreecommitdiff
path: root/bolt.go
blob: f456582012fdb420217711e6d82fa844459afff4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package bolt

import (
	"fmt"
	"os"
)

// ErrorList represents a slice of errors.
type ErrorList []error

// Error returns a readable count of the errors in the list.
func (l ErrorList) Error() string {
	return fmt.Sprintf("%d errors occurred", len(l))
}

// _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...)
}