Skip to content

Commit

Permalink
cleanup: use %w to format errors
Browse files Browse the repository at this point in the history
Use %w instead of %v to format errors.

Updates: ceph#1586

Signed-off-by: Yati Padia <ypadia@redhat.com>
  • Loading branch information
yati1998 committed Jun 25, 2021
1 parent 0ee0c12 commit e4eafde
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions e2e/pvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ func deletePVCAndPV(c kubernetes.Interface, pvc *v1.PersistentVolumeClaim, pv *v
func getPVCAndPV(c kubernetes.Interface, pvcName, pvcNamespace string) (*v1.PersistentVolumeClaim, *v1.PersistentVolume, error) {
pvc, err := c.CoreV1().PersistentVolumeClaims(pvcNamespace).Get(context.TODO(), pvcName, metav1.GetOptions{})
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{})
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
}
Expand Down
4 changes: 2 additions & 2 deletions e2e/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ func getSnapshot(path string) snapapi.VolumeSnapshot {
func newSnapshotClient() (*snapclient.SnapshotV1Client, error) {
config, err := framework.LoadConfig()
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)
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
}
Expand Down

0 comments on commit e4eafde

Please sign in to comment.