mirror of https://github.com/etcd-io/bbolt.git
pass gosimple
parent
89b9a2c19e
commit
e5514a24a6
|
@ -188,17 +188,9 @@ func (cmd *CheckCommand) Run(args ...string) error {
|
|||
// Perform consistency check.
|
||||
return db.View(func(tx *bolt.Tx) error {
|
||||
var count int
|
||||
ch := tx.Check()
|
||||
loop:
|
||||
for {
|
||||
select {
|
||||
case err, ok := <-ch:
|
||||
if !ok {
|
||||
break loop
|
||||
}
|
||||
fmt.Fprintln(cmd.Stdout, err)
|
||||
count++
|
||||
}
|
||||
for err := range tx.Check() {
|
||||
fmt.Fprintln(cmd.Stdout, err)
|
||||
count++
|
||||
}
|
||||
|
||||
// Print summary of errors.
|
||||
|
|
5
tx.go
5
tx.go
|
@ -126,10 +126,7 @@ func (tx *Tx) DeleteBucket(name []byte) error {
|
|||
// the error is returned to the caller.
|
||||
func (tx *Tx) ForEach(fn func(name []byte, b *Bucket) error) error {
|
||||
return tx.root.ForEach(func(k, v []byte) error {
|
||||
if err := fn(k, tx.root.Bucket(k)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return fn(k, tx.root.Bucket(k))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue