cleanup: use wrapped static errors instead of dynamic

In Go 1.13, the fmt.Errorf function supports a new %w verb.
When this verb is present, the error returned by fmt.Errorf
will have an Unwrap method returning the argument of %w,
which must be an error. In all other ways, %w is identical to %v.

Updates: #1227

Signed-off-by: Yug <yuggupta27@gmail.com>
This commit is contained in:
Yug
2020-07-13 09:26:51 +05:30
committed by mergify[bot]
parent 2bfe7670d2
commit 628ae9e982
7 changed files with 24 additions and 24 deletions

View File

@ -53,14 +53,14 @@ func getCredentialsForVolume(volOptions *volumeOptions, req *csi.NodeStageVolume
cr, err = util.NewAdminCredentials(secrets)
if err != nil {
return nil, fmt.Errorf("failed to get admin credentials from node stage secrets: %v", err)
return nil, fmt.Errorf("failed to get admin credentials from node stage secrets: %w", err)
}
} else {
// The volume is pre-made, credentials are in node stage secrets
cr, err = util.NewUserCredentials(req.GetSecrets())
if err != nil {
return nil, fmt.Errorf("failed to get user credentials from node stage secrets: %v", err)
return nil, fmt.Errorf("failed to get user credentials from node stage secrets: %w", err)
}
}