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

@@ -21,6 +21,7 @@ package v1
import (
"context"
"fmt"
"sync"
"github.com/containerd/cgroups"
@@ -28,7 +29,6 @@ import (
"github.com/containerd/containerd/pkg/oom"
"github.com/containerd/containerd/runtime"
"github.com/containerd/containerd/runtime/v2/shim"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
)
@@ -93,7 +93,7 @@ func (e *epoller) Run(ctx context.Context) {
func (e *epoller) Add(id string, cgx interface{}) error {
cg, ok := cgx.(cgroups.Cgroup)
if !ok {
return errors.Errorf("expected cgroups.Cgroup, got: %T", cgx)
return fmt.Errorf("expected cgroups.Cgroup, got: %T", cgx)
}
e.mu.Lock()
defer e.mu.Unlock()

View File

@@ -21,13 +21,13 @@ package v2
import (
"context"
"fmt"
cgroupsv2 "github.com/containerd/cgroups/v2"
eventstypes "github.com/containerd/containerd/api/events"
"github.com/containerd/containerd/pkg/oom"
"github.com/containerd/containerd/runtime"
"github.com/containerd/containerd/runtime/v2/shim"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -89,7 +89,7 @@ func (w *watcher) Run(ctx context.Context) {
func (w *watcher) Add(id string, cgx interface{}) error {
cg, ok := cgx.(*cgroupsv2.Manager)
if !ok {
return errors.Errorf("expected *cgroupsv2.Manager, got: %T", cgx)
return fmt.Errorf("expected *cgroupsv2.Manager, got: %T", cgx)
}
// FIXME: cgroupsv2.Manager does not support closing eventCh routine currently.
// The routine shuts down when an error happens, mostly when the cgroup is deleted.