summaryrefslogtreecommitdiff
path: root/cmd/rootlessport
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/rootlessport
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/rootlessport')
-rw-r--r--cmd/rootlessport/main.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/rootlessport/main.go b/cmd/rootlessport/main.go
index f01b9e4a6..5410cd14a 100644
--- a/cmd/rootlessport/main.go
+++ b/cmd/rootlessport/main.go
@@ -6,6 +6,7 @@ package main
import (
"context"
"encoding/json"
+ "errors"
"fmt"
"io"
"io/ioutil"
@@ -18,7 +19,6 @@ import (
"github.com/containernetworking/plugins/pkg/ns"
"github.com/containers/common/libnetwork/types"
"github.com/containers/podman/v4/pkg/rootlessport"
- "github.com/pkg/errors"
rkport "github.com/rootless-containers/rootlesskit/pkg/port"
rkbuiltin "github.com/rootless-containers/rootlesskit/pkg/port/builtin"
rkportutil "github.com/rootless-containers/rootlesskit/pkg/port/portutil"
@@ -269,16 +269,16 @@ func handler(ctx context.Context, conn io.Reader, pm rkport.Manager) error {
dec := json.NewDecoder(conn)
err := dec.Decode(&childIP)
if err != nil {
- return errors.Wrap(err, "rootless port failed to decode ports")
+ return fmt.Errorf("rootless port failed to decode ports: %w", err)
}
portStatus, err := pm.ListPorts(ctx)
if err != nil {
- return errors.Wrap(err, "rootless port failed to list ports")
+ return fmt.Errorf("rootless port failed to list ports: %w", err)
}
for _, status := range portStatus {
err = pm.RemovePort(ctx, status.ID)
if err != nil {
- return errors.Wrap(err, "rootless port failed to remove port")
+ return fmt.Errorf("rootless port failed to remove port: %w", err)
}
}
// add the ports with the new child IP
@@ -287,7 +287,7 @@ func handler(ctx context.Context, conn io.Reader, pm rkport.Manager) error {
status.Spec.ChildIP = childIP
_, err = pm.AddPort(ctx, status.Spec)
if err != nil {
- return errors.Wrap(err, "rootless port failed to add port")
+ return fmt.Errorf("rootless port failed to add port: %w", err)
}
}
return nil