aboutsummaryrefslogtreecommitdiff
path: root/pkg/util
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/util')
-rw-r--r--pkg/util/filters.go4
-rw-r--r--pkg/util/mountOpts.go54
-rw-r--r--pkg/util/utils.go58
-rw-r--r--pkg/util/utils_darwin.go2
-rw-r--r--pkg/util/utils_linux.go4
-rw-r--r--pkg/util/utils_supported.go10
-rw-r--r--pkg/util/utils_unsupported.go6
-rw-r--r--pkg/util/utils_windows.go11
8 files changed, 74 insertions, 75 deletions
diff --git a/pkg/util/filters.go b/pkg/util/filters.go
index 05ba4f82c..08148806f 100644
--- a/pkg/util/filters.go
+++ b/pkg/util/filters.go
@@ -2,6 +2,7 @@ package util
import (
"encoding/json"
+ "errors"
"fmt"
"net/http"
"path/filepath"
@@ -9,14 +10,13 @@ import (
"time"
"github.com/containers/podman/v4/pkg/timetype"
- "github.com/pkg/errors"
)
// ComputeUntilTimestamp extracts until timestamp from filters
func ComputeUntilTimestamp(filterValues []string) (time.Time, error) {
invalid := time.Time{}
if len(filterValues) != 1 {
- return invalid, errors.Errorf("specify exactly one timestamp for until")
+ return invalid, errors.New("specify exactly one timestamp for until")
}
ts, err := timetype.GetTimestamp(filterValues[0], time.Now())
if err != nil {
diff --git a/pkg/util/mountOpts.go b/pkg/util/mountOpts.go
index d1dd75a82..49fd5b467 100644
--- a/pkg/util/mountOpts.go
+++ b/pkg/util/mountOpts.go
@@ -1,16 +1,16 @@
package util
import (
+ "errors"
+ "fmt"
"strings"
-
- "github.com/pkg/errors"
)
var (
// ErrBadMntOption indicates that an invalid mount option was passed.
- ErrBadMntOption = errors.Errorf("invalid mount option")
+ ErrBadMntOption = errors.New("invalid mount option")
// ErrDupeMntOption indicates that a duplicate mount option was passed.
- ErrDupeMntOption = errors.Errorf("duplicate mount option passed")
+ ErrDupeMntOption = errors.New("duplicate mount option passed")
)
type defaultMountOptions struct {
@@ -47,7 +47,7 @@ func ProcessOptions(options []string, isTmpfs bool, sourcePath string) ([]string
if strings.HasPrefix(splitOpt[0], "idmap") {
if foundIdmap {
- return nil, errors.Wrapf(ErrDupeMntOption, "the 'idmap' option can only be set once")
+ return nil, fmt.Errorf("the 'idmap' option can only be set once: %w", ErrDupeMntOption)
}
foundIdmap = true
newOptions = append(newOptions, opt)
@@ -57,7 +57,7 @@ func ProcessOptions(options []string, isTmpfs bool, sourcePath string) ([]string
switch splitOpt[0] {
case "copy", "nocopy":
if foundCopy {
- return nil, errors.Wrapf(ErrDupeMntOption, "only one of 'nocopy' and 'copy' can be used")
+ return nil, fmt.Errorf("only one of 'nocopy' and 'copy' can be used: %w", ErrDupeMntOption)
}
foundCopy = true
case "O":
@@ -67,51 +67,51 @@ func ProcessOptions(options []string, isTmpfs bool, sourcePath string) ([]string
newOptions = append(newOptions, opt)
case "exec", "noexec":
if foundExec {
- return nil, errors.Wrapf(ErrDupeMntOption, "only one of 'noexec' and 'exec' can be used")
+ return nil, fmt.Errorf("only one of 'noexec' and 'exec' can be used: %w", ErrDupeMntOption)
}
foundExec = true
case "suid", "nosuid":
if foundSuid {
- return nil, errors.Wrapf(ErrDupeMntOption, "only one of 'nosuid' and 'suid' can be used")
+ return nil, fmt.Errorf("only one of 'nosuid' and 'suid' can be used: %w", ErrDupeMntOption)
}
foundSuid = true
case "nodev", "dev":
if foundDev {
- return nil, errors.Wrapf(ErrDupeMntOption, "only one of 'nodev' and 'dev' can be used")
+ return nil, fmt.Errorf("only one of 'nodev' and 'dev' can be used: %w", ErrDupeMntOption)
}
foundDev = true
case "rw", "ro":
if foundWrite {
- return nil, errors.Wrapf(ErrDupeMntOption, "only one of 'rw' and 'ro' can be used")
+ return nil, fmt.Errorf("only one of 'rw' and 'ro' can be used: %w", ErrDupeMntOption)
}
foundWrite = true
case "private", "rprivate", "slave", "rslave", "shared", "rshared", "unbindable", "runbindable":
if foundProp {
- return nil, errors.Wrapf(ErrDupeMntOption, "only one root propagation mode can be used")
+ return nil, fmt.Errorf("only one root propagation mode can be used: %w", ErrDupeMntOption)
}
foundProp = true
case "size":
if !isTmpfs {
- return nil, errors.Wrapf(ErrBadMntOption, "the 'size' option is only allowed with tmpfs mounts")
+ return nil, fmt.Errorf("the 'size' option is only allowed with tmpfs mounts: %w", ErrBadMntOption)
}
if foundSize {
- return nil, errors.Wrapf(ErrDupeMntOption, "only one tmpfs size can be specified")
+ return nil, fmt.Errorf("only one tmpfs size can be specified: %w", ErrDupeMntOption)
}
foundSize = true
case "mode":
if !isTmpfs {
- return nil, errors.Wrapf(ErrBadMntOption, "the 'mode' option is only allowed with tmpfs mounts")
+ return nil, fmt.Errorf("the 'mode' option is only allowed with tmpfs mounts: %w", ErrBadMntOption)
}
if foundMode {
- return nil, errors.Wrapf(ErrDupeMntOption, "only one tmpfs mode can be specified")
+ return nil, fmt.Errorf("only one tmpfs mode can be specified: %w", ErrDupeMntOption)
}
foundMode = true
case "tmpcopyup":
if !isTmpfs {
- return nil, errors.Wrapf(ErrBadMntOption, "the 'tmpcopyup' option is only allowed with tmpfs mounts")
+ return nil, fmt.Errorf("the 'tmpcopyup' option is only allowed with tmpfs mounts: %w", ErrBadMntOption)
}
if foundCopyUp {
- return nil, errors.Wrapf(ErrDupeMntOption, "the 'tmpcopyup' or 'notmpcopyup' option can only be set once")
+ return nil, fmt.Errorf("the 'tmpcopyup' or 'notmpcopyup' option can only be set once: %w", ErrDupeMntOption)
}
foundCopyUp = true
case "consistency":
@@ -120,37 +120,37 @@ func ProcessOptions(options []string, isTmpfs bool, sourcePath string) ([]string
continue
case "notmpcopyup":
if !isTmpfs {
- return nil, errors.Wrapf(ErrBadMntOption, "the 'notmpcopyup' option is only allowed with tmpfs mounts")
+ return nil, fmt.Errorf("the 'notmpcopyup' option is only allowed with tmpfs mounts: %w", ErrBadMntOption)
}
if foundCopyUp {
- return nil, errors.Wrapf(ErrDupeMntOption, "the 'tmpcopyup' or 'notmpcopyup' option can only be set once")
+ return nil, fmt.Errorf("the 'tmpcopyup' or 'notmpcopyup' option can only be set once: %w", ErrDupeMntOption)
}
foundCopyUp = true
// do not propagate notmpcopyup to the OCI runtime
continue
case "bind", "rbind":
if isTmpfs {
- return nil, errors.Wrapf(ErrBadMntOption, "the 'bind' and 'rbind' options are not allowed with tmpfs mounts")
+ return nil, fmt.Errorf("the 'bind' and 'rbind' options are not allowed with tmpfs mounts: %w", ErrBadMntOption)
}
if foundBind {
- return nil, errors.Wrapf(ErrDupeMntOption, "only one of 'rbind' and 'bind' can be used")
+ return nil, fmt.Errorf("only one of 'rbind' and 'bind' can be used: %w", ErrDupeMntOption)
}
foundBind = true
case "z", "Z":
if isTmpfs {
- return nil, errors.Wrapf(ErrBadMntOption, "the 'z' and 'Z' options are not allowed with tmpfs mounts")
+ return nil, fmt.Errorf("the 'z' and 'Z' options are not allowed with tmpfs mounts: %w", ErrBadMntOption)
}
if foundZ {
- return nil, errors.Wrapf(ErrDupeMntOption, "only one of 'z' and 'Z' can be used")
+ return nil, fmt.Errorf("only one of 'z' and 'Z' can be used: %w", ErrDupeMntOption)
}
foundZ = true
case "U":
if foundU {
- return nil, errors.Wrapf(ErrDupeMntOption, "the 'U' option can only be set once")
+ return nil, fmt.Errorf("the 'U' option can only be set once: %w", ErrDupeMntOption)
}
foundU = true
default:
- return nil, errors.Wrapf(ErrBadMntOption, "unknown mount option %q", opt)
+ return nil, fmt.Errorf("unknown mount option %q: %w", opt, ErrBadMntOption)
}
newOptions = append(newOptions, opt)
}
@@ -187,11 +187,11 @@ func ProcessOptions(options []string, isTmpfs bool, sourcePath string) ([]string
func ParseDriverOpts(option string) (string, string, error) {
token := strings.SplitN(option, "=", 2)
if len(token) != 2 {
- return "", "", errors.Wrapf(ErrBadMntOption, "cannot parse driver opts")
+ return "", "", fmt.Errorf("cannot parse driver opts: %w", ErrBadMntOption)
}
opt := strings.SplitN(token[1], "=", 2)
if len(opt) != 2 {
- return "", "", errors.Wrapf(ErrBadMntOption, "cannot parse driver opts")
+ return "", "", fmt.Errorf("cannot parse driver opts: %w", ErrBadMntOption)
}
return opt[0], opt[1], nil
}
diff --git a/pkg/util/utils.go b/pkg/util/utils.go
index ad5db9a1a..33c11d611 100644
--- a/pkg/util/utils.go
+++ b/pkg/util/utils.go
@@ -2,6 +2,7 @@ package util
import (
"encoding/json"
+ "errors"
"fmt"
"io/fs"
"math"
@@ -27,7 +28,6 @@ import (
stypes "github.com/containers/storage/types"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/opencontainers/runtime-spec/specs-go"
- "github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/term"
)
@@ -68,7 +68,7 @@ func ParseRegistryCreds(creds string) (*types.DockerAuthConfig, error) {
fmt.Print("Password: ")
termPassword, err := term.ReadPassword(0)
if err != nil {
- return nil, errors.Wrapf(err, "could not read password from terminal")
+ return nil, fmt.Errorf("could not read password from terminal: %w", err)
}
password = string(termPassword)
}
@@ -129,7 +129,7 @@ func GetImageConfig(changes []string) (ImageConfig, error) {
if len(split) != 2 {
split = strings.SplitN(change, "=", 2)
if len(split) != 2 {
- return ImageConfig{}, errors.Errorf("invalid change %q - must be formatted as KEY VALUE", change)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - must be formatted as KEY VALUE", change)
}
}
@@ -139,7 +139,7 @@ func GetImageConfig(changes []string) (ImageConfig, error) {
case "USER":
// Assume literal contents are the user.
if value == "" {
- return ImageConfig{}, errors.Errorf("invalid change %q - must provide a value to USER", change)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - must provide a value to USER", change)
}
config.User = value
case "EXPOSE":
@@ -148,14 +148,14 @@ func GetImageConfig(changes []string) (ImageConfig, error) {
// Protocol must be "tcp" or "udp"
splitPort := strings.Split(value, "/")
if len(splitPort) > 2 {
- return ImageConfig{}, errors.Errorf("invalid change %q - EXPOSE port must be formatted as PORT[/PROTO]", change)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - EXPOSE port must be formatted as PORT[/PROTO]", change)
}
portNum, err := strconv.Atoi(splitPort[0])
if err != nil {
- return ImageConfig{}, errors.Wrapf(err, "invalid change %q - EXPOSE port must be an integer", change)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - EXPOSE port must be an integer: %w", change, err)
}
if portNum > 65535 || portNum <= 0 {
- return ImageConfig{}, errors.Errorf("invalid change %q - EXPOSE port must be a valid port number", change)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - EXPOSE port must be a valid port number", change)
}
proto := "tcp"
if len(splitPort) > 1 {
@@ -164,7 +164,7 @@ func GetImageConfig(changes []string) (ImageConfig, error) {
case "tcp", "udp":
proto = testProto
default:
- return ImageConfig{}, errors.Errorf("invalid change %q - EXPOSE protocol must be TCP or UDP", change)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - EXPOSE protocol must be TCP or UDP", change)
}
}
if config.ExposedPorts == nil {
@@ -188,7 +188,7 @@ func GetImageConfig(changes []string) (ImageConfig, error) {
key = splitEnv[0]
// We do need a key
if key == "" {
- return ImageConfig{}, errors.Errorf("invalid change %q - ENV must have at least one argument", change)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - ENV must have at least one argument", change)
}
// Perfectly valid to not have a value
if len(splitEnv) == 2 {
@@ -250,11 +250,11 @@ func GetImageConfig(changes []string) (ImageConfig, error) {
testUnmarshal = strings.Split(value, " ")
}
if len(testUnmarshal) == 0 {
- return ImageConfig{}, errors.Errorf("invalid change %q - must provide at least one argument to VOLUME", change)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - must provide at least one argument to VOLUME", change)
}
for _, vol := range testUnmarshal {
if vol == "" {
- return ImageConfig{}, errors.Errorf("invalid change %q - VOLUME paths must not be empty", change)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - VOLUME paths must not be empty", change)
}
if config.Volumes == nil {
config.Volumes = make(map[string]struct{})
@@ -268,7 +268,7 @@ func GetImageConfig(changes []string) (ImageConfig, error) {
// WORKDIR c results in /A/b/c
// Just need to check it's not empty...
if value == "" {
- return ImageConfig{}, errors.Errorf("invalid change %q - must provide a non-empty WORKDIR", change)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - must provide a non-empty WORKDIR", change)
}
config.WorkingDir = filepath.Join(config.WorkingDir, value)
case "LABEL":
@@ -285,7 +285,7 @@ func GetImageConfig(changes []string) (ImageConfig, error) {
splitLabel := strings.SplitN(value, "=", 2)
// Unlike ENV, LABEL must have a value
if len(splitLabel) != 2 {
- return ImageConfig{}, errors.Errorf("invalid change %q - LABEL must be formatted key=value", change)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - LABEL must be formatted key=value", change)
}
key = splitLabel[0]
val = splitLabel[1]
@@ -298,7 +298,7 @@ func GetImageConfig(changes []string) (ImageConfig, error) {
}
// Check key after we strip quotations
if key == "" {
- return ImageConfig{}, errors.Errorf("invalid change %q - LABEL must have a non-empty key", change)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - LABEL must have a non-empty key", change)
}
if config.Labels == nil {
config.Labels = make(map[string]string)
@@ -308,17 +308,17 @@ func GetImageConfig(changes []string) (ImageConfig, error) {
// Check the provided signal for validity.
killSignal, err := ParseSignal(value)
if err != nil {
- return ImageConfig{}, errors.Wrapf(err, "invalid change %q - KILLSIGNAL must be given a valid signal", change)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - KILLSIGNAL must be given a valid signal: %w", change, err)
}
config.StopSignal = fmt.Sprintf("%d", killSignal)
case "ONBUILD":
// Onbuild always appends.
if value == "" {
- return ImageConfig{}, errors.Errorf("invalid change %q - ONBUILD must be given an argument", change)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - ONBUILD must be given an argument", change)
}
config.OnBuild = append(config.OnBuild, value)
default:
- return ImageConfig{}, errors.Errorf("invalid change %q - invalid instruction %s", change, outerKey)
+ return ImageConfig{}, fmt.Errorf("invalid change %q - invalid instruction %s", change, outerKey)
}
}
@@ -336,7 +336,7 @@ func ParseSignal(rawSignal string) (syscall.Signal, error) {
}
// 64 is SIGRTMAX; wish we could get this from a standard Go library
if sig < 1 || sig > 64 {
- return -1, errors.Errorf("valid signals are 1 through 64")
+ return -1, errors.New("valid signals are 1 through 64")
}
return sig, nil
}
@@ -362,10 +362,10 @@ func GetKeepIDMapping() (*stypes.IDMappingOptions, int, int, error) {
uids, gids, err := rootless.GetConfiguredMappings()
if err != nil {
- return nil, -1, -1, errors.Wrapf(err, "cannot read mappings")
+ return nil, -1, -1, fmt.Errorf("cannot read mappings: %w", err)
}
if len(uids) == 0 || len(gids) == 0 {
- return nil, -1, -1, errors.Wrapf(err, "keep-id requires additional UIDs or GIDs defined in /etc/subuid and /etc/subgid to function correctly")
+ return nil, -1, -1, fmt.Errorf("keep-id requires additional UIDs or GIDs defined in /etc/subuid and /etc/subgid to function correctly: %w", err)
}
maxUID, maxGID := 0, 0
for _, u := range uids {
@@ -403,10 +403,10 @@ func GetNoMapMapping() (*stypes.IDMappingOptions, int, int, error) {
}
uids, gids, err := rootless.GetConfiguredMappings()
if err != nil {
- return nil, -1, -1, errors.Wrapf(err, "cannot read mappings")
+ return nil, -1, -1, fmt.Errorf("cannot read mappings: %w", err)
}
if len(uids) == 0 || len(gids) == 0 {
- return nil, -1, -1, errors.Wrapf(err, "nomap requires additional UIDs or GIDs defined in /etc/subuid and /etc/subgid to function correctly")
+ return nil, -1, -1, fmt.Errorf("nomap requires additional UIDs or GIDs defined in /etc/subuid and /etc/subgid to function correctly: %w", err)
}
options.UIDMap, options.GIDMap = nil, nil
uid, gid := 0, 0
@@ -566,7 +566,7 @@ func ParseInputTime(inputTime string, since bool) (time.Time, error) {
// input might be a duration
duration, err := time.ParseDuration(inputTime)
if err != nil {
- return time.Time{}, errors.Errorf("unable to interpret time value")
+ return time.Time{}, errors.New("unable to interpret time value")
}
if since {
return time.Now().Add(-duration), nil
@@ -607,7 +607,7 @@ func HomeDir() (string, error) {
if home == "" {
usr, err := user.LookupId(fmt.Sprintf("%d", rootless.GetRootlessUID()))
if err != nil {
- return "", errors.Wrapf(err, "unable to resolve HOME directory")
+ return "", fmt.Errorf("unable to resolve HOME directory: %w", err)
}
home = usr.HomeDir
}
@@ -645,12 +645,12 @@ func ValidateSysctls(strSlice []string) (map[string]string, error) {
foundMatch := false
arr := strings.Split(val, "=")
if len(arr) < 2 {
- return nil, errors.Errorf("%s is invalid, sysctl values must be in the form of KEY=VALUE", val)
+ return nil, fmt.Errorf("%s is invalid, sysctl values must be in the form of KEY=VALUE", val)
}
trimmed := fmt.Sprintf("%s=%s", strings.TrimSpace(arr[0]), strings.TrimSpace(arr[1]))
if trimmed != val {
- return nil, errors.Errorf("'%s' is invalid, extra spaces found", val)
+ return nil, fmt.Errorf("'%s' is invalid, extra spaces found", val)
}
if validSysctlMap[arr[0]] {
@@ -666,7 +666,7 @@ func ValidateSysctls(strSlice []string) (map[string]string, error) {
}
}
if !foundMatch {
- return nil, errors.Errorf("sysctl '%s' is not allowed", arr[0])
+ return nil, fmt.Errorf("sysctl '%s' is not allowed", arr[0])
}
}
return sysctl, nil
@@ -680,9 +680,9 @@ func CreateCidFile(cidfile string, id string) error {
cidFile, err := OpenExclusiveFile(cidfile)
if err != nil {
if os.IsExist(err) {
- return errors.Errorf("container id file exists. Ensure another container is not using it or delete %s", cidfile)
+ return fmt.Errorf("container id file exists. Ensure another container is not using it or delete %s", cidfile)
}
- return errors.Errorf("opening cidfile %s", cidfile)
+ return fmt.Errorf("opening cidfile %s", cidfile)
}
if _, err = cidFile.WriteString(id); err != nil {
logrus.Error(err)
diff --git a/pkg/util/utils_darwin.go b/pkg/util/utils_darwin.go
index 66ae85e9c..3a2e587df 100644
--- a/pkg/util/utils_darwin.go
+++ b/pkg/util/utils_darwin.go
@@ -4,7 +4,7 @@
package util
import (
- "github.com/pkg/errors"
+ "errors"
)
func GetContainerPidInformationDescriptors() ([]string, error) {
diff --git a/pkg/util/utils_linux.go b/pkg/util/utils_linux.go
index bc522361f..e2d9e3e89 100644
--- a/pkg/util/utils_linux.go
+++ b/pkg/util/utils_linux.go
@@ -1,6 +1,7 @@
package util
import (
+ "errors"
"fmt"
"io/fs"
"io/ioutil"
@@ -14,7 +15,6 @@ import (
"github.com/containers/psgo"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/opencontainers/runtime-tools/generate"
- "github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
)
@@ -53,7 +53,7 @@ func FindDeviceNodes() (map[string]string, error) {
// We are a device node. Get major/minor.
sysstat, ok := info.Sys().(*syscall.Stat_t)
if !ok {
- return errors.Errorf("Could not convert stat output for use")
+ return errors.New("could not convert stat output for use")
}
// We must typeconvert sysstat.Rdev from uint64->int to avoid constant overflow
rdev := int(sysstat.Rdev)
diff --git a/pkg/util/utils_supported.go b/pkg/util/utils_supported.go
index 50e4b1b7b..b3d690158 100644
--- a/pkg/util/utils_supported.go
+++ b/pkg/util/utils_supported.go
@@ -7,13 +7,13 @@ package util
// should work to take darwin from this
import (
+ "errors"
"fmt"
"os"
"path/filepath"
"syscall"
"github.com/containers/podman/v4/pkg/rootless"
- "github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -51,12 +51,12 @@ func GetRuntimeDir() (string, error) {
if runtimeDir == "" {
home := os.Getenv("HOME")
if home == "" {
- rootlessRuntimeDirError = fmt.Errorf("neither XDG_RUNTIME_DIR nor HOME was set non-empty")
+ rootlessRuntimeDirError = errors.New("neither XDG_RUNTIME_DIR nor HOME was set non-empty")
return
}
resolvedHome, err := filepath.EvalSymlinks(home)
if err != nil {
- rootlessRuntimeDirError = errors.Wrapf(err, "cannot resolve %s", home)
+ rootlessRuntimeDirError = fmt.Errorf("cannot resolve %s: %w", home, err)
return
}
runtimeDir = filepath.Join(resolvedHome, "rundir")
@@ -80,7 +80,7 @@ func GetRootlessConfigHomeDir() (string, error) {
home := os.Getenv("HOME")
resolvedHome, err := filepath.EvalSymlinks(home)
if err != nil {
- rootlessConfigHomeDirError = errors.Wrapf(err, "cannot resolve %s", home)
+ rootlessConfigHomeDirError = fmt.Errorf("cannot resolve %s: %w", home, err)
return
}
tmpDir := filepath.Join(resolvedHome, ".config")
@@ -115,7 +115,7 @@ func GetRootlessPauseProcessPidPath() (string, error) {
// files.
func GetRootlessPauseProcessPidPathGivenDir(libpodTmpDir string) (string, error) {
if libpodTmpDir == "" {
- return "", errors.Errorf("must provide non-empty temporary directory")
+ return "", errors.New("must provide non-empty temporary directory")
}
return filepath.Join(libpodTmpDir, "pause.pid"), nil
}
diff --git a/pkg/util/utils_unsupported.go b/pkg/util/utils_unsupported.go
index 896346493..3a0f8646b 100644
--- a/pkg/util/utils_unsupported.go
+++ b/pkg/util/utils_unsupported.go
@@ -3,11 +3,9 @@
package util
-import (
- "github.com/pkg/errors"
-)
+import "errors"
// FindDeviceNodes is not implemented anywhere except Linux.
func FindDeviceNodes() (map[string]string, error) {
- return nil, errors.Errorf("not supported on non-Linux OSes")
+ return nil, errors.New("not supported on non-Linux OSes")
}
diff --git a/pkg/util/utils_windows.go b/pkg/util/utils_windows.go
index b91680f7a..703e5472a 100644
--- a/pkg/util/utils_windows.go
+++ b/pkg/util/utils_windows.go
@@ -4,35 +4,36 @@
package util
import (
+ "errors"
+ "fmt"
"path/filepath"
"github.com/containers/storage/pkg/homedir"
- "github.com/pkg/errors"
)
var errNotImplemented = errors.New("not yet implemented")
// IsCgroup2UnifiedMode returns whether we are running in cgroup 2 unified mode.
func IsCgroup2UnifiedMode() (bool, error) {
- return false, errors.Wrap(errNotImplemented, "IsCgroup2Unified")
+ return false, fmt.Errorf("IsCgroup2Unified: %w", errNotImplemented)
}
// GetContainerPidInformationDescriptors returns a string slice of all supported
// format descriptors of GetContainerPidInformation.
func GetContainerPidInformationDescriptors() ([]string, error) {
- return nil, errors.Wrap(errNotImplemented, "GetContainerPidInformationDescriptors")
+ return nil, fmt.Errorf("GetContainerPidInformationDescriptors: %w", errNotImplemented)
}
// GetRootlessPauseProcessPidPath returns the path to the file that holds the pid for
// the pause process
func GetRootlessPauseProcessPidPath() (string, error) {
- return "", errors.Wrap(errNotImplemented, "GetRootlessPauseProcessPidPath")
+ return "", fmt.Errorf("GetRootlessPauseProcessPidPath: %w", errNotImplemented)
}
// GetRootlessPauseProcessPidPath returns the path to the file that holds the pid for
// the pause process
func GetRootlessPauseProcessPidPathGivenDir(unused string) (string, error) {
- return "", errors.Wrap(errNotImplemented, "GetRootlessPauseProcessPidPath")
+ return "", fmt.Errorf("GetRootlessPauseProcessPidPath: %w", errNotImplemented)
}
// GetRuntimeDir returns the runtime directory