summaryrefslogtreecommitdiff
path: root/cmd/podman/images/trust_set.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/images/trust_set.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/images/trust_set.go')
-rw-r--r--cmd/podman/images/trust_set.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/podman/images/trust_set.go b/cmd/podman/images/trust_set.go
index f4ff0cffc..832e9f724 100644
--- a/cmd/podman/images/trust_set.go
+++ b/cmd/podman/images/trust_set.go
@@ -1,6 +1,7 @@
package images
import (
+ "fmt"
"net/url"
"regexp"
@@ -9,7 +10,6 @@ import (
"github.com/containers/podman/v4/cmd/podman/common"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/pkg/domain/entities"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -61,7 +61,7 @@ func setTrust(cmd *cobra.Command, args []string) error {
}
if !util.StringInSlice(setOptions.Type, validTrustTypes) {
- return errors.Errorf("invalid choice: %s (choose from 'accept', 'reject', 'signedBy')", setOptions.Type)
+ return fmt.Errorf("invalid choice: %s (choose from 'accept', 'reject', 'signedBy')", setOptions.Type)
}
return registry.ImageEngine().SetTrust(registry.Context(), args, setOptions)
}
@@ -71,17 +71,17 @@ func isValidImageURI(imguri string) (bool, error) {
uri := "http://" + imguri
u, err := url.Parse(uri)
if err != nil {
- return false, errors.Wrapf(err, "invalid image uri: %s", imguri)
+ return false, fmt.Errorf("invalid image uri: %s: %w", imguri, err)
}
reg := regexp.MustCompile(`^[a-zA-Z0-9-_\.]+\/?:?[0-9]*[a-z0-9-\/:]*$`)
ret := reg.FindAllString(u.Host, -1)
if len(ret) == 0 {
- return false, errors.Wrapf(err, "invalid image uri: %s", imguri)
+ return false, fmt.Errorf("invalid image uri: %s: %w", imguri, err)
}
reg = regexp.MustCompile(`^[a-z0-9-:\./]*$`)
ret = reg.FindAllString(u.Fragment, -1)
if len(ret) == 0 {
- return false, errors.Wrapf(err, "invalid image uri: %s", imguri)
+ return false, fmt.Errorf("invalid image uri: %s: %w", imguri, err)
}
return true, nil
}