summaryrefslogtreecommitdiff
path: root/pkg/bindings/images
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-07-08 09:24:25 +0000
committerGitHub <noreply@github.com>2022-07-08 09:24:25 +0000
commit6087fb2116aaeae995e8423872ffe637e8be128f (patch)
treee8bd00a9b325a51a49de02e868f06eec2deeb529 /pkg/bindings/images
parenta2bcf833c98cb38eb28dc65a8768963d0b7344fc (diff)
parenta46f798831df06c472b288db7b34de8536a7ea5a (diff)
downloadpodman-6087fb2116aaeae995e8423872ffe637e8be128f.tar.gz
podman-6087fb2116aaeae995e8423872ffe637e8be128f.tar.bz2
podman-6087fb2116aaeae995e8423872ffe637e8be128f.zip
Merge pull request #14839 from saschagrunert/errors-pkg
pkg: switch to golang native error wrapping
Diffstat (limited to 'pkg/bindings/images')
-rw-r--r--pkg/bindings/images/build.go14
-rw-r--r--pkg/bindings/images/images.go2
-rw-r--r--pkg/bindings/images/pull.go4
3 files changed, 10 insertions, 10 deletions
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index f14f866dd..6883585e2 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -5,6 +5,7 @@ import (
"compress/gzip"
"context"
"encoding/json"
+ "errors"
"fmt"
"io"
"io/fs"
@@ -28,7 +29,6 @@ import (
"github.com/docker/go-units"
"github.com/hashicorp/go-multierror"
jsoniter "github.com/json-iterator/go"
- "github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -543,14 +543,14 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
if err := dec.Decode(&s); err != nil {
if errors.Is(err, io.ErrUnexpectedEOF) {
- return nil, errors.Wrap(err, "server probably quit")
+ return nil, fmt.Errorf("server probably quit: %w", err)
}
// EOF means the stream is over in which case we need
// to have read the id.
if errors.Is(err, io.EOF) && id != "" {
break
}
- return &entities.BuildReport{ID: id}, errors.Wrap(err, "decoding stream")
+ return &entities.BuildReport{ID: id}, fmt.Errorf("decoding stream: %w", err)
}
switch {
@@ -574,11 +574,11 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
pm, err := fileutils.NewPatternMatcher(excludes)
if err != nil {
- return nil, errors.Wrapf(err, "error processing excludes list %v", excludes)
+ return nil, fmt.Errorf("error processing excludes list %v: %w", excludes, err)
}
if len(sources) == 0 {
- return nil, errors.New("No source(s) provided for build")
+ return nil, errors.New("no source(s) provided for build")
}
pr, pw := io.Pipe()
@@ -623,7 +623,7 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
excluded, err := pm.Matches(name) //nolint:staticcheck
if err != nil {
- return errors.Wrapf(err, "error checking if %q is excluded", name)
+ return fmt.Errorf("error checking if %q is excluded: %w", name, err)
}
if excluded {
// Note: filepath.SkipDir is not possible to use given .dockerignore semantics.
@@ -726,7 +726,7 @@ func parseDockerignore(root string) ([]string, error) {
var dockerIgnoreErr error
ignore, dockerIgnoreErr = ioutil.ReadFile(filepath.Join(root, ".dockerignore"))
if dockerIgnoreErr != nil && !os.IsNotExist(dockerIgnoreErr) {
- return nil, errors.Wrapf(err, "error reading .containerignore: '%s'", root)
+ return nil, fmt.Errorf("error reading .containerignore: '%s': %w", root, err)
}
}
rawexcludes := strings.Split(string(ignore), "\n")
diff --git a/pkg/bindings/images/images.go b/pkg/bindings/images/images.go
index 57c8bd597..cd5147629 100644
--- a/pkg/bindings/images/images.go
+++ b/pkg/bindings/images/images.go
@@ -2,6 +2,7 @@ package images
import (
"context"
+ "errors"
"fmt"
"io"
"net/http"
@@ -14,7 +15,6 @@ import (
"github.com/containers/podman/v4/pkg/bindings"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/pkg/domain/entities/reports"
- "github.com/pkg/errors"
)
// Exists a lightweight way to determine if an image exists in local storage. It returns a
diff --git a/pkg/bindings/images/pull.go b/pkg/bindings/images/pull.go
index de02c62fd..1a4aa3038 100644
--- a/pkg/bindings/images/pull.go
+++ b/pkg/bindings/images/pull.go
@@ -3,6 +3,7 @@ package images
import (
"context"
"encoding/json"
+ "errors"
"fmt"
"io"
"io/ioutil"
@@ -15,7 +16,6 @@ import (
"github.com/containers/podman/v4/pkg/bindings"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/pkg/errorhandling"
- "github.com/pkg/errors"
)
// Pull is the binding for libpod's v2 endpoints for pulling images. Note that
@@ -91,7 +91,7 @@ func Pull(ctx context.Context, rawImage string, options *PullOptions) ([]string,
images = report.Images
case report.ID != "":
default:
- return images, errors.Errorf("failed to parse pull results stream, unexpected input: %v", report)
+ return images, fmt.Errorf("failed to parse pull results stream, unexpected input: %v", report)
}
}
return images, errorhandling.JoinErrors(pullErrors)