summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/parse/parse.go
diff options
context:
space:
mode:
authorSascha Grunert <sgrunert@redhat.com>2022-07-06 09:48:36 +0200
committerSascha Grunert <sgrunert@redhat.com>2022-07-08 08:54:47 +0200
commita46f798831df06c472b288db7b34de8536a7ea5a (patch)
treec370fb0fc23b461691906e308b179a50e583228b /pkg/domain/infra/abi/parse/parse.go
parent862cc42ddc11ff56b41be128182b748b0843dff3 (diff)
downloadpodman-a46f798831df06c472b288db7b34de8536a7ea5a.tar.gz
podman-a46f798831df06c472b288db7b34de8536a7ea5a.tar.bz2
podman-a46f798831df06c472b288db7b34de8536a7ea5a.zip
pkg: switch to golang native error wrapping
We now use the golang error wrapping format specifier `%w` instead of the deprecated github.com/pkg/errors package. [NO NEW TESTS NEEDED] Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
Diffstat (limited to 'pkg/domain/infra/abi/parse/parse.go')
-rw-r--r--pkg/domain/infra/abi/parse/parse.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/pkg/domain/infra/abi/parse/parse.go b/pkg/domain/infra/abi/parse/parse.go
index 4e8c2e508..19699589b 100644
--- a/pkg/domain/infra/abi/parse/parse.go
+++ b/pkg/domain/infra/abi/parse/parse.go
@@ -1,13 +1,13 @@
package parse
import (
+ "fmt"
"strconv"
"strings"
"github.com/containers/podman/v4/libpod"
"github.com/containers/podman/v4/libpod/define"
units "github.com/docker/go-units"
- "github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -32,7 +32,7 @@ func VolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error)
case "size":
size, err := units.FromHumanSize(splitO[1])
if err != nil {
- return nil, errors.Wrapf(err, "cannot convert size %s to integer", splitO[1])
+ return nil, fmt.Errorf("cannot convert size %s to integer: %w", splitO[1], err)
}
libpodOptions = append(libpodOptions, libpod.WithVolumeSize(uint64(size)))
finalVal = append(finalVal, o)
@@ -41,7 +41,7 @@ func VolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error)
case "inodes":
inodes, err := strconv.ParseUint(splitO[1], 10, 64)
if err != nil {
- return nil, errors.Wrapf(err, "cannot convert inodes %s to integer", splitO[1])
+ return nil, fmt.Errorf("cannot convert inodes %s to integer: %w", splitO[1], err)
}
libpodOptions = append(libpodOptions, libpod.WithVolumeInodes(inodes))
finalVal = append(finalVal, o)
@@ -49,11 +49,11 @@ func VolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error)
volumeOptions["INODES"] = splitO[1]
case "uid":
if len(splitO) != 2 {
- return nil, errors.Wrapf(define.ErrInvalidArg, "uid option must provide a UID")
+ return nil, fmt.Errorf("uid option must provide a UID: %w", define.ErrInvalidArg)
}
intUID, err := strconv.Atoi(splitO[1])
if err != nil {
- return nil, errors.Wrapf(err, "cannot convert UID %s to integer", splitO[1])
+ return nil, fmt.Errorf("cannot convert UID %s to integer: %w", splitO[1], err)
}
logrus.Debugf("Removing uid= from options and adding WithVolumeUID for UID %d", intUID)
libpodOptions = append(libpodOptions, libpod.WithVolumeUID(intUID), libpod.WithVolumeNoChown())
@@ -62,11 +62,11 @@ func VolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error)
volumeOptions["UID"] = splitO[1]
case "gid":
if len(splitO) != 2 {
- return nil, errors.Wrapf(define.ErrInvalidArg, "gid option must provide a GID")
+ return nil, fmt.Errorf("gid option must provide a GID: %w", define.ErrInvalidArg)
}
intGID, err := strconv.Atoi(splitO[1])
if err != nil {
- return nil, errors.Wrapf(err, "cannot convert GID %s to integer", splitO[1])
+ return nil, fmt.Errorf("cannot convert GID %s to integer: %w", splitO[1], err)
}
logrus.Debugf("Removing gid= from options and adding WithVolumeGID for GID %d", intGID)
libpodOptions = append(libpodOptions, libpod.WithVolumeGID(intGID), libpod.WithVolumeNoChown())
@@ -80,11 +80,11 @@ func VolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error)
volumeOptions["NOQUOTA"] = "true"
case "timeout":
if len(splitO) != 2 {
- return nil, errors.Wrapf(define.ErrInvalidArg, "timeout option must provide a valid timeout in seconds")
+ return nil, fmt.Errorf("timeout option must provide a valid timeout in seconds: %w", define.ErrInvalidArg)
}
intTimeout, err := strconv.Atoi(splitO[1])
if err != nil {
- return nil, errors.Wrapf(err, "cannot convert Timeout %s to an integer", splitO[1])
+ return nil, fmt.Errorf("cannot convert Timeout %s to an integer: %w", splitO[1], err)
}
logrus.Debugf("Removing timeout from options and adding WithTimeout for Timeout %d", intTimeout)
libpodOptions = append(libpodOptions, libpod.WithVolumeDriverTimeout(intTimeout))