mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
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:
committed by
mergify[bot]
parent
7affb9289d
commit
de74c36d8c
@ -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
|
||||
|
Reference in New Issue
Block a user