aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman-mac-helper/install.go
diff options
context:
space:
mode:
authorSascha Grunert <sgrunert@redhat.com>2022-06-30 10:05:44 +0200
committerSascha Grunert <sgrunert@redhat.com>2022-06-30 12:58:57 +0200
commite8adec5f41388916b0f2206dc898a5587d51467c (patch)
tree856d4c6e84366560554bb91c5a0c33e0c0e29509 /cmd/podman-mac-helper/install.go
parent3426d56b92be2ac1c3cc62fc578e9cb6d64aca81 (diff)
downloadpodman-e8adec5f41388916b0f2206dc898a5587d51467c.tar.gz
podman-e8adec5f41388916b0f2206dc898a5587d51467c.tar.bz2
podman-e8adec5f41388916b0f2206dc898a5587d51467c.zip
cmd/podman: 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. Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
Diffstat (limited to 'cmd/podman-mac-helper/install.go')
-rw-r--r--cmd/podman-mac-helper/install.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/cmd/podman-mac-helper/install.go b/cmd/podman-mac-helper/install.go
index a1b99e66c..7b8753820 100644
--- a/cmd/podman-mac-helper/install.go
+++ b/cmd/podman-mac-helper/install.go
@@ -5,6 +5,7 @@ package main
import (
"bytes"
+ "errors"
"fmt"
"io"
"io/fs"
@@ -14,7 +15,6 @@ import (
"syscall"
"text/template"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -111,7 +111,7 @@ func install(cmd *cobra.Command, args []string) error {
file, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_EXCL, rw_r_r)
if err != nil {
- return errors.Wrap(err, "error creating helper plist file")
+ return fmt.Errorf("creating helper plist file: %w", err)
}
defer file.Close()
_, err = buf.WriteTo(file)
@@ -120,7 +120,7 @@ func install(cmd *cobra.Command, args []string) error {
}
if err = runDetectErr("launchctl", "load", fileName); err != nil {
- return errors.Wrap(err, "launchctl failed loading service")
+ return fmt.Errorf("launchctl failed loading service: %w", err)
}
return nil
@@ -133,13 +133,13 @@ func restrictRecursive(targetDir string, until string) error {
return err
}
if info.Mode()&fs.ModeSymlink != 0 {
- return errors.Errorf("symlinks not allowed in helper paths (remove them and rerun): %s", targetDir)
+ return fmt.Errorf("symlinks not allowed in helper paths (remove them and rerun): %s", targetDir)
}
if err = os.Chown(targetDir, 0, 0); err != nil {
- return errors.Wrap(err, "could not update ownership of helper path")
+ return fmt.Errorf("could not update ownership of helper path: %w", err)
}
if err = os.Chmod(targetDir, rwx_rx_rx|fs.ModeSticky); err != nil {
- return errors.Wrap(err, "could not update permissions of helper path")
+ return fmt.Errorf("could not update permissions of helper path: %w", err)
}
targetDir = filepath.Dir(targetDir)
}
@@ -162,7 +162,7 @@ func verifyRootDeep(path string) error {
stat := info.Sys().(*syscall.Stat_t)
if stat.Uid != 0 {
- return errors.Errorf("installation target path must be solely owned by root: %s is not", current)
+ return fmt.Errorf("installation target path must be solely owned by root: %s is not", current)
}
if info.Mode()&fs.ModeSymlink != 0 {
@@ -206,7 +206,7 @@ func installExecutable(user string) (string, error) {
targetDir := filepath.Join(installPrefix, "podman", "helper", user)
if err := os.MkdirAll(targetDir, rwx_rx_rx); err != nil {
- return "", errors.Wrap(err, "could not create helper directory structure")
+ return "", fmt.Errorf("could not create helper directory structure: %w", err)
}
// Correct any incorrect perms on previously existing directories and verify no symlinks