Skip to content

Commit

Permalink
cleanup: use err and target in recommended order to errors.Is()
Browse files Browse the repository at this point in the history
The documentation has `error.Is(err, target)`, so use this as the order
of the parameters.

Signed-off-by: Niels de Vos <[email protected]>
  • Loading branch information
nixpanic committed Oct 11, 2024
1 parent 3802dd2 commit 112c851
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/rbd/group/volume_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (vg *volumeGroup) Delete(ctx context.Context) error {
}

err = librbd.GroupRemove(ioctx, name)
if err != nil && !errors.Is(rados.ErrNotFound, err) {
if err != nil && !errors.Is(err, rados.ErrNotFound) {
return fmt.Errorf("failed to remove volume group %q: %w", vg, err)
}

Expand Down Expand Up @@ -245,7 +245,7 @@ func (vg *volumeGroup) RemoveVolume(ctx context.Context, vol types.Volume) error

err := vol.RemoveFromGroup(ctx, vg)
if err != nil {
if errors.Is(librbd.ErrNotExist, err) {
if errors.Is(err, librbd.ErrNotExist) {
return nil
}

Expand Down

0 comments on commit 112c851

Please sign in to comment.