Skip to content

Commit 999b61b

Browse files
author
Ariel Kass
committed
resolving lint issues - gocritic (skip), godot, funcorder
Signed-off-by: Ariel Kass <[email protected]>
1 parent 422dcd9 commit 999b61b

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

controllers/pvc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
)
2828

2929
// getPVCDataSource get pvc, pv object from the request.
30+
//nolint:gocritic
3031
func (r VolumeReplicationReconciler) getPVCDataSource(ctx context.Context, logger logr.Logger, req types.NamespacedName) (*corev1.PersistentVolumeClaim, *corev1.PersistentVolume, error) {
3132
pvc := &corev1.PersistentVolumeClaim{}
3233
err := r.Client.Get(ctx, req, pvc)

controllers/vg.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
)
2727

2828
// getVGDataSource get vg content, vg object from the request.
29+
//nolint:gocritic
2930
func (r VolumeReplicationReconciler) getVGDataSource(ctx context.Context, logger logr.Logger, req types.NamespacedName) (*volumegroupv1.VolumeGroup, *volumegroupv1.VolumeGroupContent, error) {
3031
vg := &volumegroupv1.VolumeGroup{}
3132
err := r.Client.Get(ctx, req, vg)

controllers/volumereplication_controller.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -388,24 +388,6 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re
388388
return ctrl.Result{}, nil
389389
}
390390

391-
func (r *VolumeReplicationReconciler) updateReplicationStatus(
392-
ctx context.Context,
393-
instance *replicationv1alpha1.VolumeReplication,
394-
logger logr.Logger,
395-
state replicationv1alpha1.State,
396-
message string) error {
397-
instance.Status.State = state
398-
instance.Status.Message = message
399-
instance.Status.ObservedGeneration = instance.Generation
400-
if err := r.Client.Status().Update(ctx, instance); err != nil {
401-
logger.Error(err, "failed to update status")
402-
403-
return err
404-
}
405-
406-
return nil
407-
}
408-
409391
// SetupWithManager sets up the controller with the Manager.
410392
func (r *VolumeReplicationReconciler) SetupWithManager(mgr ctrl.Manager, cfg *config.DriverConfig) error {
411393
err := r.waitForCrds()
@@ -445,6 +427,24 @@ func (r *VolumeReplicationReconciler) SetupWithManager(mgr ctrl.Manager, cfg *co
445427
WithEventFilter(pred).Complete(r)
446428
}
447429

430+
func (r *VolumeReplicationReconciler) updateReplicationStatus(
431+
ctx context.Context,
432+
instance *replicationv1alpha1.VolumeReplication,
433+
logger logr.Logger,
434+
state replicationv1alpha1.State,
435+
message string) error {
436+
instance.Status.State = state
437+
instance.Status.Message = message
438+
instance.Status.ObservedGeneration = instance.Generation
439+
if err := r.Client.Status().Update(ctx, instance); err != nil {
440+
logger.Error(err, "failed to update status")
441+
442+
return err
443+
}
444+
445+
return nil
446+
}
447+
448448
func (r *VolumeReplicationReconciler) waitForCrds() error {
449449
logger := r.Log.WithName("checkingDependencies")
450450

@@ -665,8 +665,8 @@ func (r *VolumeReplicationReconciler) enableReplication(logger logr.Logger, repl
665665

666666
// getVolumeContentSource is a helper function to process provisioning requests that include a DataSource
667667
// currently we provide Snapshot and PVC, the default case allows the provisioner to still create a volume
668-
// so that an external controller can act upon it. Additional DataSource types can be added here with
669-
// an appropriate implementation function
668+
// so that an external controller can act upon it. Additional DataSource types can be added here with
669+
// an appropriate implementation function.
670670
func (r *VolumeReplicationReconciler) getReplicationSource(logger logr.Logger, kind string, volumeHandle string) (*replicationlib.ReplicationSource, error) {
671671
switch kind {
672672
case pvcDataSource:

controllers/volumereplicationclass.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
)
2828

2929
// getVolumeReplicationClass get volume replication class object from the subjected namespace and return the same.
30+
//nolint:gocritic
3031
func (r VolumeReplicationReconciler) getVolumeReplicationClass(ctx context.Context, logger logr.Logger, vrcName string) (*replicationv1alpha1.VolumeReplicationClass, error) {
3132
vrcObj := &replicationv1alpha1.VolumeReplicationClass{}
3233
err := r.Client.Get(ctx, types.NamespacedName{Name: vrcName}, vrcObj)

0 commit comments

Comments
 (0)