From b9b8392f710067e3384e6c3686f8d185f2b9fd99 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 2 Jun 2023 14:18:47 +0200 Subject: [PATCH] build: address `errorlint` warning Signed-off-by: Niels de Vos --- internal/nfs/controller/volume.go | 10 +++++----- internal/rbd/rbd_journal.go | 2 +- internal/rbd/rbd_util.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/nfs/controller/volume.go b/internal/nfs/controller/volume.go index 4ceeb8c98..2249f8c61 100644 --- a/internal/nfs/controller/volume.go +++ b/internal/nfs/controller/volume.go @@ -270,14 +270,14 @@ func (nv *NFSVolume) getNFSCluster() (string, error) { fs := fscore.NewFileSystem(nv.conn) fsName, err := fs.GetFsName(nv.ctx, nv.fscID) if err != nil && errors.Is(err, util.ErrPoolNotFound) { - return "", fmt.Errorf("%w for ID %x: %v", ErrFilesystemNotFound, nv.fscID, err) + return "", fmt.Errorf("%w for ID %x: %w", ErrFilesystemNotFound, nv.fscID, err) } else if err != nil { return "", fmt.Errorf("failed to get filesystem name for ID %x: %w", nv.fscID, err) } mdPool, err := fs.GetMetadataPool(nv.ctx, fsName) if err != nil && errors.Is(err, util.ErrPoolNotFound) { - return "", fmt.Errorf("metadata pool for %q %w: %v", fsName, ErrNotFound, err) + return "", fmt.Errorf("metadata pool for %q %w: %w", fsName, ErrNotFound, err) } else if err != nil { return "", fmt.Errorf("failed to get metadata pool for %q: %w", fsName, err) } @@ -291,7 +291,7 @@ func (nv *NFSVolume) getNFSCluster() (string, error) { clusterName, err := j.FetchAttribute(nv.ctx, mdPool, nv.objectUUID, clusterNameKey) if err != nil && errors.Is(err, util.ErrPoolNotFound) || errors.Is(err, util.ErrKeyNotFound) { - return "", fmt.Errorf("cluster name for %q %w: %v", nv.objectUUID, ErrNotFound, err) + return "", fmt.Errorf("cluster name for %q %w: %w", nv.objectUUID, ErrNotFound, err) } else if err != nil { return "", fmt.Errorf("failed to get cluster name for %q: %w", nv.objectUUID, err) } @@ -308,14 +308,14 @@ func (nv *NFSVolume) setNFSCluster(clusterName string) error { fs := fscore.NewFileSystem(nv.conn) fsName, err := fs.GetFsName(nv.ctx, nv.fscID) if err != nil && errors.Is(err, util.ErrPoolNotFound) { - return fmt.Errorf("%w for ID %x: %v", ErrFilesystemNotFound, nv.fscID, err) + return fmt.Errorf("%w for ID %x: %w", ErrFilesystemNotFound, nv.fscID, err) } else if err != nil { return fmt.Errorf("failed to get filesystem name for ID %x: %w", nv.fscID, err) } mdPool, err := fs.GetMetadataPool(nv.ctx, fsName) if err != nil && errors.Is(err, util.ErrPoolNotFound) { - return fmt.Errorf("metadata pool for %q %w: %v", fsName, ErrNotFound, err) + return fmt.Errorf("metadata pool for %q %w: %w", fsName, ErrNotFound, err) } else if err != nil { return fmt.Errorf("failed to get metadata pool for %q: %w", fsName, err) } diff --git a/internal/rbd/rbd_journal.go b/internal/rbd/rbd_journal.go index 2570e3a0c..49bb241b3 100644 --- a/internal/rbd/rbd_journal.go +++ b/internal/rbd/rbd_journal.go @@ -567,7 +567,7 @@ func RegenerateJournal( err = vi.DecomposeCSIID(rbdVol.VolID) if err != nil { - return "", fmt.Errorf("%w: error decoding volume ID (%s) (%s)", + return "", fmt.Errorf("%w: error decoding volume ID (%w) (%s)", ErrInvalidVolID, err, rbdVol.VolID) } diff --git a/internal/rbd/rbd_util.go b/internal/rbd/rbd_util.go index 4e299ec60..64d786d73 100644 --- a/internal/rbd/rbd_util.go +++ b/internal/rbd/rbd_util.go @@ -1175,7 +1175,7 @@ func GenVolFromVolID( err := vi.DecomposeCSIID(volumeID) if err != nil { - return vol, fmt.Errorf("%w: error decoding volume ID (%s) (%s)", + return vol, fmt.Errorf("%w: error decoding volume ID (%w) (%s)", ErrInvalidVolID, err, volumeID) }