sandbox: replace github.com/pkg/errors with native errors

PR #6366 implemented a tree-wide change to replace github.com/pkg/errors
to errors. The new sandbox API PR #6703 had few errors.Wrap*() leftovers
and pulled github.com/pkg/errors back. This commit replaces those
leftovers by following the pattern in #6366.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
This commit is contained in:
Mikko Ylinen
2022-05-12 16:03:27 +03:00
parent e85b5a0b81
commit 523d069a25
3 changed files with 21 additions and 21 deletions

View File

@@ -18,6 +18,7 @@ package containerd
import (
"context"
"errors"
"fmt"
"time"
@@ -27,7 +28,6 @@ import (
"github.com/containerd/containerd/protobuf/types"
api "github.com/containerd/containerd/sandbox"
"github.com/containerd/typeurl"
"github.com/pkg/errors"
)
// Sandbox is a high level client to containerd's sandboxes.
@@ -183,7 +183,7 @@ func WithSandboxRuntime(name string, options interface{}) NewSandboxOpts {
opts, err := typeurl.MarshalAny(options)
if err != nil {
return errors.Wrap(err, "failed to marshal sandbox runtime options")
return fmt.Errorf("failed to marshal sandbox runtime options: %w", err)
}
s.Runtime = api.RuntimeOpts{
@@ -206,7 +206,7 @@ func WithSandboxSpec(s *oci.Spec, opts ...oci.SpecOpts) NewSandboxOpts {
spec, err := typeurl.MarshalAny(s)
if err != nil {
return errors.Wrap(err, "failed to marshal spec")
return fmt.Errorf("failed to marshal spec: %w", err)
}
sandbox.Spec = spec
@@ -223,7 +223,7 @@ func WithSandboxExtension(name string, ext interface{}) NewSandboxOpts {
any, err := typeurl.MarshalAny(ext)
if err != nil {
return errors.Wrap(err, "failed to marshal sandbox extension")
return fmt.Errorf("failed to marshal sandbox extension: %w", err)
}
s.Extensions[name] = any