aboutsummaryrefslogtreecommitdiff
path: root/pkg/domain/infra/tunnel/manifest.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/tunnel/manifest.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/tunnel/manifest.go')
-rw-r--r--pkg/domain/infra/tunnel/manifest.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/pkg/domain/infra/tunnel/manifest.go b/pkg/domain/infra/tunnel/manifest.go
index 09c37b896..d2554f198 100644
--- a/pkg/domain/infra/tunnel/manifest.go
+++ b/pkg/domain/infra/tunnel/manifest.go
@@ -3,6 +3,7 @@ package tunnel
import (
"context"
"encoding/json"
+ "errors"
"fmt"
"strings"
@@ -10,7 +11,6 @@ import (
"github.com/containers/podman/v4/pkg/bindings/images"
"github.com/containers/podman/v4/pkg/bindings/manifests"
"github.com/containers/podman/v4/pkg/domain/entities"
- "github.com/pkg/errors"
)
// ManifestCreate implements manifest create via ImageEngine
@@ -18,7 +18,7 @@ func (ir *ImageEngine) ManifestCreate(ctx context.Context, name string, images [
options := new(manifests.CreateOptions).WithAll(opts.All)
imageID, err := manifests.Create(ir.ClientCtx, name, images, options)
if err != nil {
- return imageID, errors.Wrapf(err, "error creating manifest")
+ return imageID, fmt.Errorf("error creating manifest: %w", err)
}
return imageID, err
}
@@ -36,12 +36,12 @@ func (ir *ImageEngine) ManifestExists(ctx context.Context, name string) (*entiti
func (ir *ImageEngine) ManifestInspect(_ context.Context, name string) ([]byte, error) {
list, err := manifests.Inspect(ir.ClientCtx, name, nil)
if err != nil {
- return nil, errors.Wrapf(err, "error getting content of manifest list or image %s", name)
+ return nil, fmt.Errorf("error getting content of manifest list or image %s: %w", name, err)
}
buf, err := json.MarshalIndent(list, "", " ")
if err != nil {
- return buf, errors.Wrapf(err, "error rendering manifest for display")
+ return buf, fmt.Errorf("error rendering manifest for display: %w", err)
}
return buf, err
}
@@ -56,7 +56,7 @@ func (ir *ImageEngine) ManifestAdd(_ context.Context, name string, imageNames []
for _, annotationSpec := range opts.Annotation {
spec := strings.SplitN(annotationSpec, "=", 2)
if len(spec) != 2 {
- return "", errors.Errorf("no value given for annotation %q", spec[0])
+ return "", fmt.Errorf("no value given for annotation %q", spec[0])
}
annotations[spec[0]] = spec[1]
}
@@ -72,7 +72,7 @@ func (ir *ImageEngine) ManifestAdd(_ context.Context, name string, imageNames []
id, err := manifests.Add(ir.ClientCtx, name, options)
if err != nil {
- return id, errors.Wrapf(err, "error adding to manifest list %s", name)
+ return id, fmt.Errorf("error adding to manifest list %s: %w", name, err)
}
return id, nil
}
@@ -86,7 +86,7 @@ func (ir *ImageEngine) ManifestAnnotate(ctx context.Context, name, images string
func (ir *ImageEngine) ManifestRemoveDigest(ctx context.Context, name string, image string) (string, error) {
updatedListID, err := manifests.Remove(ir.ClientCtx, name, image, nil)
if err != nil {
- return updatedListID, errors.Wrapf(err, "error removing from manifest %s", name)
+ return updatedListID, fmt.Errorf("error removing from manifest %s: %w", name, err)
}
return fmt.Sprintf("%s :%s\n", updatedListID, image), nil
}