diff options
author | Sascha Grunert <sgrunert@redhat.com> | 2022-07-05 11:42:22 +0200 |
---|---|---|
committer | Sascha Grunert <sgrunert@redhat.com> | 2022-07-05 16:06:32 +0200 |
commit | 251d91699de4e9aaab53ab6fea262d4b6bdaae8e (patch) | |
tree | 1995c85a69f48bf129565ca60ea0b3d6205a04b4 /libpod/define | |
parent | 340eeed0cb20855f1e6d2670704cfe67df3314f6 (diff) | |
download | podman-251d91699de4e9aaab53ab6fea262d4b6bdaae8e.tar.gz podman-251d91699de4e9aaab53ab6fea262d4b6bdaae8e.tar.bz2 podman-251d91699de4e9aaab53ab6fea262d4b6bdaae8e.zip |
libpod: 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.
[NO NEW TESTS NEEDED]
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
Diffstat (limited to 'libpod/define')
-rw-r--r-- | libpod/define/containerstate.go | 5 | ||||
-rw-r--r-- | libpod/define/exec_codes.go | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/libpod/define/containerstate.go b/libpod/define/containerstate.go index 9ad3aec08..00080ef37 100644 --- a/libpod/define/containerstate.go +++ b/libpod/define/containerstate.go @@ -1,9 +1,8 @@ package define import ( + "fmt" "time" - - "github.com/pkg/errors" ) // ContainerStatus represents the current state of a container @@ -91,7 +90,7 @@ func StringToContainerStatus(status string) (ContainerStatus, error) { case ContainerStateRemoving.String(): return ContainerStateRemoving, nil default: - return ContainerStateUnknown, errors.Wrapf(ErrInvalidArg, "unknown container state: %s", status) + return ContainerStateUnknown, fmt.Errorf("unknown container state: %s: %w", status, ErrInvalidArg) } } diff --git a/libpod/define/exec_codes.go b/libpod/define/exec_codes.go index f94616b33..3f2da4910 100644 --- a/libpod/define/exec_codes.go +++ b/libpod/define/exec_codes.go @@ -1,9 +1,9 @@ package define import ( + "errors" "strings" - "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -23,10 +23,10 @@ const ( // has a predefined exit code associated. If so, it returns that, otherwise it returns // the exit code originally stated in libpod.Exec() func TranslateExecErrorToExitCode(originalEC int, err error) int { - if errors.Cause(err) == ErrOCIRuntimePermissionDenied { + if errors.Is(err, ErrOCIRuntimePermissionDenied) { return ExecErrorCodeCannotInvoke } - if errors.Cause(err) == ErrOCIRuntimeNotFound { + if errors.Is(err, ErrOCIRuntimeNotFound) { return ExecErrorCodeNotFound } return originalEC |