diff options
author | openshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com> | 2022-07-05 16:10:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-05 16:10:12 +0000 |
commit | 39fc5d1f4f26f82ed1ca23d97f43924335c4c529 (patch) | |
tree | e0a54c6d0e3a1bc238cb5ef4a9316b55b39217ee /libpod/container_stat_linux.go | |
parent | 9539a89ee77682ed3f4d1d0be3b950523e2f2439 (diff) | |
parent | 251d91699de4e9aaab53ab6fea262d4b6bdaae8e (diff) | |
download | podman-39fc5d1f4f26f82ed1ca23d97f43924335c4c529.tar.gz podman-39fc5d1f4f26f82ed1ca23d97f43924335c4c529.tar.bz2 podman-39fc5d1f4f26f82ed1ca23d97f43924335c4c529.zip |
Merge pull request #14828 from saschagrunert/errors-libpod
libpod: switch to golang native error wrapping
Diffstat (limited to 'libpod/container_stat_linux.go')
-rw-r--r-- | libpod/container_stat_linux.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libpod/container_stat_linux.go b/libpod/container_stat_linux.go index bbe3edbb3..72aabb516 100644 --- a/libpod/container_stat_linux.go +++ b/libpod/container_stat_linux.go @@ -4,6 +4,8 @@ package libpod import ( + "errors" + "fmt" "os" "path/filepath" "strings" @@ -11,7 +13,6 @@ import ( "github.com/containers/buildah/copier" "github.com/containers/podman/v4/libpod/define" "github.com/containers/podman/v4/pkg/copy" - "github.com/pkg/errors" ) // statInsideMount stats the specified path *inside* the container's mount and PID @@ -150,10 +151,10 @@ func secureStat(root string, path string) (*copier.StatForItem, error) { } if len(globStats) != 1 { - return nil, errors.Errorf("internal error: secureStat: expected 1 item but got %d", len(globStats)) + return nil, fmt.Errorf("internal error: secureStat: expected 1 item but got %d", len(globStats)) } if len(globStats) != 1 { - return nil, errors.Errorf("internal error: secureStat: expected 1 result but got %d", len(globStats[0].Results)) + return nil, fmt.Errorf("internal error: secureStat: expected 1 result but got %d", len(globStats[0].Results)) } // NOTE: the key in the map differ from `glob` when hitting symlink. @@ -167,7 +168,7 @@ func secureStat(root string, path string) (*copier.StatForItem, error) { if stat.IsSymlink { target, err := copier.Eval(root, path, copier.EvalOptions{}) if err != nil { - return nil, errors.Wrap(err, "error evaluating symlink in container") + return nil, fmt.Errorf("error evaluating symlink in container: %w", err) } // Need to make sure the symlink is relative to the root! target = strings.TrimPrefix(target, root) |