Skip to content

Commit

Permalink
libct/keys: stop using pkg/errors
Browse files Browse the repository at this point in the history
Use fmt.Errorf with %w instead.

Convert the users to the new wrapping.

This fixes an errorlint warning.

Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Jun 9, 2021
1 parent 5b01dcc commit 34cbc22
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions libcontainer/keys/keyctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
package keys

import (
"errors"
"fmt"
"strconv"
"strings"

"github.com/pkg/errors"

"golang.org/x/sys/unix"
)

Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion libcontainer/setns_init_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
Expand Down
2 changes: 1 addition & 1 deletion libcontainer/standard_init_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 34cbc22

Please sign in to comment.