Esempio n. 1
0
// mustCheck runs a consistency check on the database and panics if any errors are found.
func mustCheck(db *bolt.DB) {
	if err := db.Check(); err != nil {
		// Copy db off first.
		var path = tempfile()
		db.CopyFile(path, 0600)

		if errors, ok := err.(bolt.ErrorList); ok {
			for _, err := range errors {
				fmt.Println(err)
			}
		}
		fmt.Println(err)
		panic("check failure: " + path)
	}
}