Skip to content

Commit

Permalink
rbd: fix arguments have the wrong order (staticcheck)
Browse files Browse the repository at this point in the history
Signed-off-by: Praveen M <[email protected]>
  • Loading branch information
iPraveenParihar committed Dec 20, 2024
1 parent d750f21 commit 898cb40
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.env
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GO111MODULE=on
COMMITLINT_VERSION=latest

# static checks and linters
GOLANGCI_VERSION=v1.60.3
GOLANGCI_VERSION=v1.62.2

# external snapshotter version
# Refer: https://github.com/kubernetes-csi/external-snapshotter/releases
Expand Down
4 changes: 2 additions & 2 deletions internal/rbd/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func (rv *rbdVolume) NewSnapshotByID(
log.DebugLog(ctx, "going to clone snapshot image %q from image %q with snapshot ID %d", snap, rv, id)

err = librbd.CloneImageByID(rv.ioctx, rv.RbdImageName, id, rv.ioctx, snap.RbdImageName, options)
if err != nil && !errors.Is(librbd.ErrExist, err) {
if err != nil && !errors.Is(err, librbd.ErrExist) {
log.ErrorLog(ctx, "failed to clone snapshot %q with id %d: %v", snap, id, err)

return nil, fmt.Errorf("failed to clone %q with snapshot id %d as new image %q: %w", rv.RbdImageName, id, snap, err)
Expand Down Expand Up @@ -342,7 +342,7 @@ func (rv *rbdVolume) NewSnapshotByID(
defer image.Close()

snapImage, err = image.CreateSnapshot(snap.RbdSnapName)
if err != nil && !errors.Is(librbd.ErrExist, err) {
if err != nil && !errors.Is(err, librbd.ErrExist) {
return nil, fmt.Errorf("failed to create snapshot on image %q: %w", snap, err)
}

Expand Down
1 change: 1 addition & 0 deletions scripts/golangci.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ linters:
# TODO: enable linters added in golangci-lint 1.43
- contextcheck
- mnd
- gomnd
- ireturn
- tagliatelle
- varnamelen
Expand Down

0 comments on commit 898cb40

Please sign in to comment.