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>
This commit is contained in:
Sascha Grunert
2022-07-05 11:42:22 +02:00
parent 340eeed0cb
commit 251d91699d
96 changed files with 1564 additions and 1542 deletions

View File

@ -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