From 34cbc2276744631e5f1b688550dfddf825aca906 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 8 Jun 2021 20:59:05 -0700 Subject: [PATCH] libct/keys: stop using pkg/errors Use fmt.Errorf with %w instead. Convert the users to the new wrapping. This fixes an errorlint warning. Signed-off-by: Kir Kolyshkin --- libcontainer/keys/keyctl.go | 6 +++--- libcontainer/setns_init_linux.go | 2 +- libcontainer/standard_init_linux.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libcontainer/keys/keyctl.go b/libcontainer/keys/keyctl.go index 4a60c34b842..412b724ee12 100644 --- a/libcontainer/keys/keyctl.go +++ b/libcontainer/keys/keyctl.go @@ -3,11 +3,11 @@ package keys import ( + "errors" + "fmt" "strconv" "strings" - "github.com/pkg/errors" - "golang.org/x/sys/unix" ) @@ -16,7 +16,7 @@ type KeySerial uint32 func JoinSessionKeyring(name string) (KeySerial, error) { sessKeyID, err := unix.KeyctlJoinSessionKeyring(name) if err != nil { - return 0, errors.Wrap(err, "create session key") + return 0, fmt.Errorf("unable to create session key: %w", err) } return KeySerial(sessKeyID), nil } diff --git a/libcontainer/setns_init_linux.go b/libcontainer/setns_init_linux.go index 2d7e5814e8a..1feb67d0415 100644 --- a/libcontainer/setns_init_linux.go +++ b/libcontainer/setns_init_linux.go @@ -44,7 +44,7 @@ func (l *linuxSetnsInit) Init() error { // don't bail on ENOSYS. // // TODO(cyphar): And we should have logging here too. - if errors.Cause(err) != unix.ENOSYS { + if !errors.Is(err, unix.ENOSYS) { return errors.Wrap(err, "join session keyring") } } diff --git a/libcontainer/standard_init_linux.go b/libcontainer/standard_init_linux.go index 45c6d66cb1e..7b2986c5a92 100644 --- a/libcontainer/standard_init_linux.go +++ b/libcontainer/standard_init_linux.go @@ -65,7 +65,7 @@ func (l *linuxStandardInit) Init() error { // // TODO(cyphar): Log this so people know what's going on, once we // have proper logging in 'runc init'. - if errors.Cause(err) != unix.ENOSYS { + if !errors.Is(err, unix.ENOSYS) { return errors.Wrap(err, "join session keyring") } } else {