mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
cleanup: use standard Golang errors package
"github.com/pkg/errors" does not offer more functionlity than that we need from the standard "errors" package. With Golang v1.13 errors can be wrapped with `fmt.Errorf("... %w", err)`. `errors.Is()` and `errors.As()` are available as well. See-also: https://tip.golang.org/doc/go1.13#error_wrapping Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
8effa0cd3e
commit
92aae4834e
@ -20,13 +20,12 @@ import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"crypto/rand"
|
||||
|
||||
"k8s.io/klog"
|
||||
@ -186,7 +185,7 @@ func VolumeMapper(volumeID string) (mapperFile, mapperFilePath string) {
|
||||
func EncryptVolume(ctx context.Context, devicePath, passphrase string) error {
|
||||
klog.V(4).Infof(Log(ctx, "Encrypting device %s with LUKS"), devicePath)
|
||||
if _, _, err := LuksFormat(devicePath, passphrase); err != nil {
|
||||
return errors.Wrapf(err, "failed to encrypt device %s with LUKS", devicePath)
|
||||
return fmt.Errorf("failed to encrypt device %s with LUKS: %w", devicePath, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user