From 06dd9136a253521cb74497a59f2e6894806a5b6d Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Mon, 21 Mar 2022 15:47:01 +0100 Subject: fix a number of errcheck issues Numerous issues remain, especially in tests/e2e. Signed-off-by: Valentin Rothberg --- pkg/rootless/rootless.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pkg/rootless/rootless.go') diff --git a/pkg/rootless/rootless.go b/pkg/rootless/rootless.go index f526aa9e1..13f8078e2 100644 --- a/pkg/rootless/rootless.go +++ b/pkg/rootless/rootless.go @@ -1,6 +1,8 @@ package rootless import ( + "errors" + "fmt" "os" "sort" "sync" @@ -8,7 +10,6 @@ import ( "github.com/containers/storage/pkg/lockfile" "github.com/opencontainers/runc/libcontainer/user" spec "github.com/opencontainers/runtime-spec/specs-go" - "github.com/pkg/errors" ) // TryJoinPauseProcess attempts to join the namespaces of the pause PID via @@ -16,7 +17,7 @@ import ( // file. func TryJoinPauseProcess(pausePidPath string) (bool, int, error) { if _, err := os.Stat(pausePidPath); err != nil { - if os.IsNotExist(err) { + if errors.Is(err, os.ErrNotExist) { return false, -1, nil } return false, -1, err @@ -34,7 +35,7 @@ func TryJoinPauseProcess(pausePidPath string) (bool, int, error) { if os.IsNotExist(err) { return false, -1, nil } - return false, -1, errors.Wrapf(err, "error acquiring lock on %s", pausePidPath) + return false, -1, fmt.Errorf("error acquiring lock on %s: %w", pausePidPath, err) } pidFileLock.Lock() -- cgit v1.2.3-54-g00ecf