feat: replace github.com/pkg/errors to errors

Signed-off-by: haoyun <yun.hao@daocloud.io>
Co-authored-by: zounengren <zouyee1989@gmail.com>
This commit is contained in:
haoyun
2022-01-07 10:19:31 +08:00
parent 3ccd43c8f6
commit bbe46b8c43
299 changed files with 1896 additions and 1874 deletions

View File

@@ -23,10 +23,10 @@ package storage
import (
"context"
"fmt"
"sync"
"github.com/containerd/containerd/snapshots"
"github.com/pkg/errors"
bolt "go.etcd.io/bbolt"
)
@@ -88,7 +88,7 @@ func (ms *MetaStore) TransactionContext(ctx context.Context, writable bool) (con
db, err := bolt.Open(ms.dbfile, 0600, nil)
if err != nil {
ms.dbL.Unlock()
return ctx, nil, errors.Wrap(err, "failed to open database file")
return ctx, nil, fmt.Errorf("failed to open database file: %w", err)
}
ms.db = db
}
@@ -96,7 +96,7 @@ func (ms *MetaStore) TransactionContext(ctx context.Context, writable bool) (con
tx, err := ms.db.Begin(writable)
if err != nil {
return ctx, nil, errors.Wrap(err, "failed to start transaction")
return ctx, nil, fmt.Errorf("failed to start transaction: %w", err)
}
ctx = context.WithValue(ctx, transactionKey{}, tx)