Skip to content

Commit

Permalink
chore: Address linter issues
Browse files Browse the repository at this point in the history
Some are rather nitpicky, others are more of the "how do I Go" category.

Signed-off-by: Manuel Hutter <[email protected]>
  • Loading branch information
mhutter committed Oct 9, 2024
1 parent 7713061 commit 106ab8f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion operator/backupcontroller/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (b *BackupExecutor) startBackup(ctx context.Context) error {

backupItems, err := b.listAndFilterPVCs(ctx, cfg.Config.BackupAnnotation)
if err != nil {
b.Generic.SetConditionFalseWithMessage(ctx, k8upv1.ConditionReady, k8upv1.ReasonRetrievalFailed, err.Error())
b.Generic.SetConditionFalseWithMessage(ctx, k8upv1.ConditionReady, k8upv1.ReasonRetrievalFailed, "%s", err.Error())
return err
}

Expand Down
4 changes: 2 additions & 2 deletions operator/backupcontroller/prebackup.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ func (b *BackupExecutor) allDeploymentsAreReady(ctx context.Context, deployments
ready, err := isPreBackupDeploymentReady(deployment)
if err != nil {
log.Info("backup failed: deadline exceeded on pre backup deployment")
b.SetConditionFalseWithMessage(ctx, k8upv1.ConditionPreBackupPodReady, k8upv1.ReasonFailed, err.Error())
b.SetConditionTrueWithMessage(ctx, k8upv1.ConditionReady, k8upv1.ReasonFailed, err.Error())
b.SetConditionFalseWithMessage(ctx, k8upv1.ConditionPreBackupPodReady, k8upv1.ReasonFailed, "%s", err.Error())
b.SetConditionTrueWithMessage(ctx, k8upv1.ConditionReady, k8upv1.ReasonFailed, "%s", err.Error())
b.deletePreBackupDeployment(ctx, deployment)
return false, err
}
Expand Down
4 changes: 2 additions & 2 deletions operator/backupcontroller/prebackup_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ func (b *BackupExecutor) fetchOrCreatePreBackupDeployment(ctx context.Context, d
if fetchErr != nil {
if !errors.IsNotFound(fetchErr) {
err := fmt.Errorf("error getting pre backup pod '%v': %w", name.String(), fetchErr)
b.SetConditionFalseWithMessage(ctx, k8upv1.ConditionPreBackupPodReady, k8upv1.ReasonRetrievalFailed, err.Error())
b.SetConditionFalseWithMessage(ctx, k8upv1.ConditionPreBackupPodReady, k8upv1.ReasonRetrievalFailed, "%s", err.Error())
return err
}

createErr := b.Client.Create(ctx, deployment)
if createErr != nil {
err := fmt.Errorf("error creating pre backup pod '%v': %w", name.String(), createErr)
b.SetConditionFalseWithMessage(ctx, k8upv1.ConditionPreBackupPodReady, k8upv1.ReasonCreationFailed, err.Error())
b.SetConditionFalseWithMessage(ctx, k8upv1.ConditionPreBackupPodReady, k8upv1.ReasonCreationFailed, "%s", err.Error())
return err
}
log.Info("started pre backup pod", "preBackup", name.String())
Expand Down
2 changes: 1 addition & 1 deletion restic/s3/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (c *Client) deleteBucketByName(ctx context.Context, name string) error {

// Print errors received from RemoveObjects API
for e := range errorCh {
return fmt.Errorf("Failed to remove " + e.ObjectName + ", error: " + e.Err.Error())
return fmt.Errorf("Failed to remove %v ,error: %v", e.ObjectName, e.Err.Error())
}

return c.minioClient.RemoveBucket(ctx, name)
Expand Down

0 comments on commit 106ab8f

Please sign in to comment.