summaryrefslogtreecommitdiff
path: root/pkg/copy
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/copy
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/copy')
-rw-r--r--pkg/copy/fileinfo.go7
-rw-r--r--pkg/copy/parse.go5
2 files changed, 6 insertions, 6 deletions
diff --git a/pkg/copy/fileinfo.go b/pkg/copy/fileinfo.go
index 0ccca5b6e..7d4e67896 100644
--- a/pkg/copy/fileinfo.go
+++ b/pkg/copy/fileinfo.go
@@ -3,13 +3,14 @@ package copy
import (
"encoding/base64"
"encoding/json"
+ "errors"
+ "fmt"
"net/http"
"os"
"path/filepath"
"strings"
"github.com/containers/podman/v4/libpod/define"
- "github.com/pkg/errors"
)
// XDockerContainerPathStatHeader is the *key* in http headers pointing to the
@@ -18,7 +19,7 @@ const XDockerContainerPathStatHeader = "X-Docker-Container-Path-Stat"
// ErrENOENT mimics the stdlib's ErrENOENT and can be used to implement custom logic
// while preserving the user-visible error message.
-var ErrENOENT = errors.New("No such file or directory")
+var ErrENOENT = errors.New("no such file or directory")
// FileInfo describes a file or directory and is returned by
// (*CopyItem).Stat().
@@ -29,7 +30,7 @@ type FileInfo = define.FileInfo
func EncodeFileInfo(info *FileInfo) (string, error) {
buf, err := json.Marshal(&info)
if err != nil {
- return "", errors.Wrap(err, "failed to serialize file stats")
+ return "", fmt.Errorf("failed to serialize file stats: %w", err)
}
return base64.URLEncoding.EncodeToString(buf), nil
}
diff --git a/pkg/copy/parse.go b/pkg/copy/parse.go
index 93edec5fa..50f1d211d 100644
--- a/pkg/copy/parse.go
+++ b/pkg/copy/parse.go
@@ -1,9 +1,8 @@
package copy
import (
+ "fmt"
"strings"
-
- "github.com/pkg/errors"
)
// ParseSourceAndDestination parses the source and destination input into a
@@ -19,7 +18,7 @@ func ParseSourceAndDestination(source, destination string) (string, string, stri
destContainer, destPath := parseUserInput(destination)
if len(sourcePath) == 0 || len(destPath) == 0 {
- return "", "", "", "", errors.Errorf("invalid arguments %q, %q: you must specify paths", source, destination)
+ return "", "", "", "", fmt.Errorf("invalid arguments %q, %q: you must specify paths", source, destination)
}
return sourceContainer, sourcePath, destContainer, destPath, nil