mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-26 08:10:20 +00:00
cleanup: use %w to format errors
Use %w instead of %v to format errors. Updates: #1586 Signed-off-by: Yati Padia <ypadia@redhat.com>
This commit is contained in:
parent
d8e3a7a778
commit
7f7a41d23a
@ -159,11 +159,11 @@ func getPVCAndPV(
|
|||||||
pvcName, pvcNamespace string) (*v1.PersistentVolumeClaim, *v1.PersistentVolume, error) {
|
pvcName, pvcNamespace string) (*v1.PersistentVolumeClaim, *v1.PersistentVolume, error) {
|
||||||
pvc, err := c.CoreV1().PersistentVolumeClaims(pvcNamespace).Get(context.TODO(), pvcName, metav1.GetOptions{})
|
pvc, err := c.CoreV1().PersistentVolumeClaims(pvcNamespace).Get(context.TODO(), pvcName, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, fmt.Errorf("failed to get PVC with error %v", err)
|
return nil, nil, fmt.Errorf("failed to get PVC: %w", err)
|
||||||
}
|
}
|
||||||
pv, err := c.CoreV1().PersistentVolumes().Get(context.TODO(), pvc.Spec.VolumeName, metav1.GetOptions{})
|
pv, err := c.CoreV1().PersistentVolumes().Get(context.TODO(), pvc.Spec.VolumeName, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pvc, nil, fmt.Errorf("failed to get PV with error %v", err)
|
return pvc, nil, fmt.Errorf("failed to get PV: %w", err)
|
||||||
}
|
}
|
||||||
return pvc, pv, nil
|
return pvc, pv, nil
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,11 @@ func getSnapshot(path string) snapapi.VolumeSnapshot {
|
|||||||
func newSnapshotClient() (*snapclient.SnapshotV1Client, error) {
|
func newSnapshotClient() (*snapclient.SnapshotV1Client, error) {
|
||||||
config, err := framework.LoadConfig()
|
config, err := framework.LoadConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error creating client: %v", err.Error())
|
return nil, fmt.Errorf("error creating client: %w", err)
|
||||||
}
|
}
|
||||||
c, err := snapclient.NewForConfig(config)
|
c, err := snapclient.NewForConfig(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error creating snapshot client: %v", err.Error())
|
return nil, fmt.Errorf("error creating snapshot client: %w", err)
|
||||||
}
|
}
|
||||||
return c, err
|
return c, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user