From d4dad7c18921c7b50cc164c670591d728e2e2fc9 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Thu, 25 Jun 2020 10:35:19 +0200 Subject: [PATCH] cleanup: use errors.As() in rbd.NodeUnstageVolume() See-also: https://github.com/golang/go/wiki/ErrorValueFAQ#how-should-i-change-my-error-handling-code-to-work-with-the-new-features Signed-off-by: Niels de Vos --- internal/rbd/nodeserver.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/rbd/nodeserver.go b/internal/rbd/nodeserver.go index ca3307ecf..26fddf16f 100644 --- a/internal/rbd/nodeserver.go +++ b/internal/rbd/nodeserver.go @@ -18,6 +18,7 @@ package rbd import ( "context" + "errors" "fmt" "os" "strconv" @@ -675,7 +676,8 @@ func (ns *NodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstag } // If not mounted, and error is anything other than metadata file missing, it is an error - if _, ok := err.(ErrMissingStash); !ok { + var ems ErrMissingStash + if !errors.As(err, &ems) { return nil, status.Error(codes.Internal, err.Error()) }