Fix: bad return and error naming

This commit is contained in:
kayos@tcp.direct 2022-01-01 12:06:56 -08:00
parent 6bf1dd4b76
commit 531f956039
2 changed files with 5 additions and 5 deletions

@ -11,7 +11,7 @@ import (
// DB is an implementation of Filer using bitcask.
type DB struct {
store map[string]*bitcask.Bitcask
mu *sync.RWMutex
mu *sync.RWMutex
}
// Initialize opens a bitcask store at the given path to be referenced by bucketName.
@ -24,7 +24,7 @@ func (db *DB) Initialize(bucketName, path string) error {
if !strings.HasSuffix("/", path) {
path = path + "/"
}
c, e := bitcask.Open(path+bucketName)
c, e := bitcask.Open(path + bucketName)
if e != nil {
return e
}
@ -77,7 +77,7 @@ func (db *DB) WithAll(action withAllAction) error {
case Sync:
err = namedErr(name, store.Sync())
default:
return unknownAction
return errUnknownAction
}
if err == nil {
continue

@ -5,13 +5,13 @@ import (
"strings"
)
var unknownAction = errors.New("unknown action")
var errUnknownAction = errors.New("unknown action")
func namedErr(name string, err error) error {
if err == nil {
return nil
}
errors.New(name+": "+err.Error())
return errors.New(name+": "+err.Error())
}
func compoundErrors(errs []error) error {