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

@@ -31,7 +31,6 @@ import (
"time"
"github.com/containerd/continuity/fs/fstest"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"gotest.tools/v3/assert"
@@ -287,7 +286,7 @@ func updateFile(name string) applierFn {
path := filepath.Join(root, name)
file, err := os.OpenFile(path, os.O_WRONLY, 0600)
if err != nil {
return errors.Wrapf(err, "failed to open %q", path)
return fmt.Errorf("failed to open %q: %w", path, err)
}
info, err := file.Stat()
@@ -305,7 +304,7 @@ func updateFile(name string) applierFn {
}
if _, err := file.WriteAt(buf, offset); err != nil {
return errors.Wrapf(err, "failed to write %q at offset %d", path, offset)
return fmt.Errorf("failed to write %q at offset %d: %w", path, offset, err)
}
return file.Close()