cleanup: address err113 warnings about direct error comparisons

Several places in the code compared errors directly with the go-ceph
sentinel errors.  This change uses the errors.Is() function of go
1.13 instead.  The err113 linter reported this issue as:

err113: do not compare errors directly, use errors.Is() instead

Signed-off-by: Sven Anderson <sven@redhat.com>
This commit is contained in:
Sven Anderson
2020-07-02 23:43:40 +02:00
committed by mergify[bot]
parent 7affb9289d
commit de74c36d8c
4 changed files with 29 additions and 29 deletions

View File

@ -269,7 +269,7 @@ func (rv *rbdVolume) open() (*librbd.Image, error) {
image, err := librbd.OpenImage(rv.ioctx, rv.RbdImageName, librbd.NoSnapshot)
if err != nil {
if err == librbd.ErrNotFound {
if errors.Is(err, librbd.ErrNotFound) {
err = ErrImageNotFound{rv.RbdImageName, err}
}
return nil, err
@ -851,7 +851,7 @@ func (rv *rbdVolume) deleteSnapshot(ctx context.Context, pOpts *rbdSnapshot) err
return fmt.Errorf("snapshot value is nil for %s", pOpts.RbdSnapName)
}
err = snap.Remove()
if err == librbd.ErrNotFound {
if errors.Is(err, librbd.ErrNotFound) {
return ErrSnapNotFound{snapName: pOpts.RbdSnapName, err: err}
}
return err