summaryrefslogtreecommitdiff
path: root/cmd/podman/pods/rm.go
diff options
context:
space:
mode:
authorSascha Grunert <sgrunert@redhat.com>2022-06-30 10:05:44 +0200
committerSascha Grunert <sgrunert@redhat.com>2022-06-30 12:58:57 +0200
commite8adec5f41388916b0f2206dc898a5587d51467c (patch)
tree856d4c6e84366560554bb91c5a0c33e0c0e29509 /cmd/podman/pods/rm.go
parent3426d56b92be2ac1c3cc62fc578e9cb6d64aca81 (diff)
downloadpodman-e8adec5f41388916b0f2206dc898a5587d51467c.tar.gz
podman-e8adec5f41388916b0f2206dc898a5587d51467c.tar.bz2
podman-e8adec5f41388916b0f2206dc898a5587d51467c.zip
cmd/podman: switch to golang native error wrapping
We now use the golang error wrapping format specifier `%w` instead of the deprecated github.com/pkg/errors package. Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
Diffstat (limited to 'cmd/podman/pods/rm.go')
-rw-r--r--cmd/podman/pods/rm.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/cmd/podman/pods/rm.go b/cmd/podman/pods/rm.go
index 16b7191c9..2ffd968f9 100644
--- a/cmd/podman/pods/rm.go
+++ b/cmd/podman/pods/rm.go
@@ -2,6 +2,7 @@ package pods
import (
"context"
+ "errors"
"fmt"
"strings"
@@ -13,7 +14,6 @@ import (
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/pkg/specgenutil"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -112,11 +112,7 @@ func removePods(namesOrIDs []string, rmOptions entities.PodRmOptions, printIDs b
}
func setExitCode(err error) {
- cause := errors.Cause(err)
- switch {
- case cause == define.ErrNoSuchPod:
- registry.SetExitCode(1)
- case strings.Contains(cause.Error(), define.ErrNoSuchPod.Error()):
+ if errors.Is(err, define.ErrNoSuchPod) || strings.Contains(err.Error(), define.ErrNoSuchPod.Error()) {
registry.SetExitCode(1)
}
}