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 <sgrunert@redhat.com>
This commit is contained in:
Sascha Grunert
2022-07-05 11:42:22 +02:00
parent 340eeed0cb
commit 251d91699d
96 changed files with 1564 additions and 1542 deletions

View File

@ -1,9 +1,10 @@
package libpod
import (
"fmt"
"github.com/containers/podman/v4/libpod/define"
pluginapi "github.com/docker/go-plugins-helpers/volume"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@ -29,7 +30,7 @@ func (v *Volume) Inspect() (*define.InspectVolumeData, error) {
data.Mountpoint = v.state.MountPoint
if v.plugin == nil {
return nil, errors.Wrapf(define.ErrMissingPlugin, "volume %s uses volume plugin %s but it is not available, cannot inspect", v.Name(), v.config.Driver)
return nil, fmt.Errorf("volume %s uses volume plugin %s but it is not available, cannot inspect: %w", v.Name(), v.config.Driver, define.ErrMissingPlugin)
}
// Retrieve status for the volume.
@ -38,7 +39,7 @@ func (v *Volume) Inspect() (*define.InspectVolumeData, error) {
req.Name = v.Name()
resp, err := v.plugin.GetVolume(req)
if err != nil {
return nil, errors.Wrapf(err, "error retrieving volume %s information from plugin %s", v.Name(), v.Driver())
return nil, fmt.Errorf("error retrieving volume %s information from plugin %s: %w", v.Name(), v.Driver(), err)
}
if resp != nil {
data.Status = resp.Status