summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-07-05 07:23:22 +0000
committerGitHub <noreply@github.com>2022-07-05 07:23:22 +0000
commit773eead54e2e0877e92d5871625a6cc32c582d30 (patch)
tree9463bca52c2c0a9db27c9dd5052fa78c0b27a22a /utils
parent3e7e66edad1269420cb45bcabbd93ac4d0e1b585 (diff)
parent597de7a083c329bdaed7fc469555a4142f71bcb8 (diff)
downloadpodman-773eead54e2e0877e92d5871625a6cc32c582d30.tar.gz
podman-773eead54e2e0877e92d5871625a6cc32c582d30.tar.bz2
podman-773eead54e2e0877e92d5871625a6cc32c582d30.zip
Merge pull request #14789 from saschagrunert/libpod-errors
libpod/runtime: switch to golang native error wrapping
Diffstat (limited to 'utils')
-rw-r--r--utils/utils.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/utils/utils.go b/utils/utils.go
index 9239cf907..a20181b0a 100644
--- a/utils/utils.go
+++ b/utils/utils.go
@@ -16,7 +16,6 @@ import (
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/storage/pkg/archive"
"github.com/godbus/dbus/v5"
- "github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -114,7 +113,7 @@ func UntarToFileSystem(dest string, tarball *os.File, options *archive.TarOption
func CreateTarFromSrc(source string, dest string) error {
file, err := os.Create(dest)
if err != nil {
- return errors.Wrapf(err, "Could not create tarball file '%s'", dest)
+ return fmt.Errorf("could not create tarball file '%s': %w", dest, err)
}
defer file.Close()
return TarToFilesystem(source, file)
@@ -154,7 +153,7 @@ func RemoveScientificNotationFromFloat(x float64) (float64, error) {
}
result, err := strconv.ParseFloat(bigNum, 64)
if err != nil {
- return x, errors.Wrapf(err, "unable to remove scientific number from calculations")
+ return x, fmt.Errorf("unable to remove scientific number from calculations: %w", err)
}
return result, nil
}
@@ -181,11 +180,11 @@ func moveProcessPIDFileToScope(pidPath, slice, scope string) error {
if os.IsNotExist(err) {
return nil
}
- return errors.Wrapf(err, "cannot read pid file %s", pidPath)
+ return fmt.Errorf("cannot read pid file %s: %w", pidPath, err)
}
pid, err := strconv.ParseUint(string(data), 10, 0)
if err != nil {
- return errors.Wrapf(err, "cannot parse pid file %s", pidPath)
+ return fmt.Errorf("cannot parse pid file %s: %w", pidPath, err)
}
return moveProcessToScope(int(pid), slice, scope)