From 251d91699de4e9aaab53ab6fea262d4b6bdaae8e Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Tue, 5 Jul 2022 11:42:22 +0200 Subject: libpod: 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 --- libpod/stats.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libpod/stats.go') diff --git a/libpod/stats.go b/libpod/stats.go index eaac9d7d0..c7e9e5128 100644 --- a/libpod/stats.go +++ b/libpod/stats.go @@ -4,6 +4,7 @@ package libpod import ( + "fmt" "math" "strings" "syscall" @@ -13,7 +14,6 @@ import ( "github.com/containers/common/pkg/cgroups" "github.com/containers/podman/v4/libpod/define" - "github.com/pkg/errors" ) // GetContainerStats gets the running stats for a given container. @@ -25,7 +25,7 @@ func (c *Container) GetContainerStats(previousStats *define.ContainerStats) (*de stats.Name = c.Name() if c.config.NoCgroups { - return nil, errors.Wrapf(define.ErrNoCgroups, "cannot run top on container %s as it did not create a cgroup", c.ID()) + return nil, fmt.Errorf("cannot run top on container %s as it did not create a cgroup: %w", c.ID(), define.ErrNoCgroups) } if !c.batched { @@ -55,13 +55,13 @@ func (c *Container) GetContainerStats(previousStats *define.ContainerStats) (*de } cgroup, err := cgroups.Load(cgroupPath) if err != nil { - return stats, errors.Wrapf(err, "unable to load cgroup at %s", cgroupPath) + return stats, fmt.Errorf("unable to load cgroup at %s: %w", cgroupPath, err) } // Ubuntu does not have swap memory in cgroups because swap is often not enabled. cgroupStats, err := cgroup.Stat() if err != nil { - return stats, errors.Wrapf(err, "unable to obtain cgroup stats") + return stats, fmt.Errorf("unable to obtain cgroup stats: %w", err) } conState := c.state.State netStats, err := getContainerNetIO(c) -- cgit v1.2.3-54-g00ecf