Skip to content

Commit

Permalink
Fix errors to make revive happy
Browse files Browse the repository at this point in the history
- Add Err prefix
- Remove unneeded error type
- Start error message with lower letter (Waiting -> waiting)
- Remove tailing punctuation (...)

Signed-off-by: Nir Soffer <[email protected]>
  • Loading branch information
nirs committed Dec 2, 2024
1 parent b4c98e0 commit a5f28ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions internal/controller/drplacementcontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ const (
)

var (
WaitForAppResourceRestoreToComplete error = errors.New("Waiting for App resources to be restored...")
WaitForVolSyncDestRepToComplete error = errors.New("Waiting for VolSync RD to complete...")
WaitForSourceCluster error = errors.New("Waiting for primary to provide Protected PVCs...")
WaitForVolSyncManifestWorkCreation error = errors.New("Waiting for VolSync ManifestWork to be created...")
WaitForVolSyncRDInfoAvailibility error = errors.New("Waiting for VolSync RDInfo...")
ErrWaitForAppResourceRestoreToComplete = errors.New("waiting for App resources to be restored")
ErrWaitForVolSyncDestRepToComplete = errors.New("waiting for VolSync RD to complete")
ErrWaitForSourceCluster = errors.New("waiting for primary to provide Protected PVCs")
ErrWaitForVolSyncManifestWorkCreation = errors.New("waiting for VolSync ManifestWork to be created")
ErrWaitForVolSyncRDInfoAvailibility = errors.New("waiting for VolSync RDInfo")
)

type DRType string
Expand Down Expand Up @@ -1315,13 +1315,13 @@ func (d *DRPCInstance) switchToCluster(targetCluster, targetClusterNamespace str
d.setProgression(rmn.ProgressionWaitingForResourceRestore)

// We just created MWs. Give it time until the App resources have been restored
return fmt.Errorf("%w)", WaitForAppResourceRestoreToComplete)
return fmt.Errorf("%w)", ErrWaitForAppResourceRestoreToComplete)
}

if !d.checkReadiness(targetCluster) {
d.setProgression(rmn.ProgressionWaitingForResourceRestore)

return fmt.Errorf("%w)", WaitForAppResourceRestoreToComplete)
return fmt.Errorf("%w)", ErrWaitForAppResourceRestoreToComplete)
}

err = d.updateUserPlacementRule(targetCluster, targetClusterNamespace)
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/drplacementcontrolvolsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (d *DRPCInstance) EnsureSecondaryReplicationSetup(srcCluster string) error
}

if opResult == ctrlutil.OperationResultCreated {
return WaitForVolSyncManifestWorkCreation
return ErrWaitForVolSyncManifestWorkCreation
}

if _, found := d.vrgs[srcCluster]; !found {
Expand Down Expand Up @@ -99,7 +99,7 @@ func (d *DRPCInstance) IsVolSyncReplicationRequired(homeCluster string) (bool, e
}

if len(vrg.Status.ProtectedPVCs) == 0 {
return false, WaitForSourceCluster
return false, ErrWaitForSourceCluster
}

for _, protectedPVC := range vrg.Status.ProtectedPVCs {
Expand Down

0 comments on commit a5f28ba

Please sign in to comment.