Skip to content

Commit

Permalink
Make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
ary1992 committed Sep 6, 2024
1 parent 5ac3ad7 commit 69f0290
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions pkg/controller/deployment_machineset_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ func updateMachineSetStatus(ctx context.Context, machineClient machineapi.Machin
var getErr, updateErr error
var updatedIS *v1alpha1.MachineSet
for i, is := 0, is; ; i++ {
klog.V(4).Infof(fmt.Sprintf("Updating status for MachineSet: %s/%s, ", is.Namespace, is.Name) +
fmt.Sprintf("replicas %d->%d (need %d), ", is.Status.Replicas, newStatus.Replicas, is.Spec.Replicas) +
fmt.Sprintf("fullyLabeledReplicas %d->%d, ", is.Status.FullyLabeledReplicas, newStatus.FullyLabeledReplicas) +
fmt.Sprintf("readyReplicas %d->%d, ", is.Status.ReadyReplicas, newStatus.ReadyReplicas) +
fmt.Sprintf("availableReplicas %d->%d, ", is.Status.AvailableReplicas, newStatus.AvailableReplicas) +
klog.V(4).Infof("%s", fmt.Sprintf("Updating status for MachineSet: %s/%s, ", is.Namespace, is.Name)+
fmt.Sprintf("replicas %d->%d (need %d), ", is.Status.Replicas, newStatus.Replicas, is.Spec.Replicas)+
fmt.Sprintf("fullyLabeledReplicas %d->%d, ", is.Status.FullyLabeledReplicas, newStatus.FullyLabeledReplicas)+
fmt.Sprintf("readyReplicas %d->%d, ", is.Status.ReadyReplicas, newStatus.ReadyReplicas)+
fmt.Sprintf("availableReplicas %d->%d, ", is.Status.AvailableReplicas, newStatus.AvailableReplicas)+
fmt.Sprintf("sequence No: %v->%v", is.Status.ObservedGeneration, newStatus.ObservedGeneration))

is.Status = newStatus
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/machine_safety.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func (c *controller) unfreezeMachineSet(ctx context.Context, machineSet *v1alpha

if machineSet == nil {
err := fmt.Errorf("SafetyController: Machine Set not passed")
klog.Errorf(err.Error())
klog.Errorf("%s", err.Error())
return err
}

Expand Down Expand Up @@ -443,7 +443,7 @@ func (c *controller) unfreezeMachineDeployment(ctx context.Context, machineDeplo

if machineDeployment == nil {
err := fmt.Errorf("SafetyController: Machine Deployment not passed")
klog.Errorf(err.Error())
klog.Errorf("%s", err.Error())
return err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/test/utils/matchers/deep.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func newDeepEqualMatcher(expected interface{}) gomegatypes.GomegaMatcher {

func (m *deepMatcher) Match(actual interface{}) (success bool, err error) {
if actual == nil && m.expected == nil {
return false, fmt.Errorf(deepMatcherNilError)
return false, fmt.Errorf("%s", deepMatcherNilError)
}

return m.compareFn(m.expected, actual), nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/provider/drain/drain.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ func (o *Options) waitForReattach(ctx context.Context, podVolumeInfo PodVolumeIn
case <-ctx.Done():
// Timeout occurred waiting for reattachment, exit function with error
klog.Warningf("Timeout occurred while waiting for PVs %v to reattach to a different node", podVolumeInfo.persistentVolumeList)
return fmt.Errorf(reattachTimeoutErr)
return fmt.Errorf("%s", reattachTimeoutErr)

case incomingEvent := <-volumeAttachmentEventCh:
persistentVolumeName := *incomingEvent.Spec.Source.PersistentVolumeName
Expand Down
6 changes: 3 additions & 3 deletions pkg/util/provider/drain/drain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ var _ = Describe("drain", func() {
nodes := d.client.CoreV1().Nodes()
node, err := nodes.Get(context.TODO(), pod.Spec.NodeName, metav1.GetOptions{})
if err != nil {
fmt.Fprintln(GinkgoWriter, err)
_, _ = fmt.Fprintln(GinkgoWriter, err)
continue
}

Expand Down Expand Up @@ -245,10 +245,10 @@ var _ = Describe("drain", func() {
}

_, err = nodes.Update(context.TODO(), node, metav1.UpdateOptions{})
fmt.Fprintln(GinkgoWriter, err)
_, _ = fmt.Fprintln(GinkgoWriter, err)

_, err = nodes.UpdateStatus(context.TODO(), node, metav1.UpdateOptions{})
fmt.Fprintln(GinkgoWriter, err)
_, _ = fmt.Fprintln(GinkgoWriter, err)
}
}()

Expand Down
6 changes: 3 additions & 3 deletions pkg/util/provider/machinecontroller/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,7 @@ var _ = Describe("machine", func() {
},
},
expect: expect{
err: fmt.Errorf(fmt.Sprintf("Force Drain successful. %s", machineutils.DelVolumesAttachments)),
err: fmt.Errorf("%s", fmt.Sprintf("Force Drain successful. %s", machineutils.DelVolumesAttachments)),
retry: machineutils.ShortRetry,
machine: newMachine(
&v1alpha1.MachineTemplateSpec{
Expand Down Expand Up @@ -1912,7 +1912,7 @@ var _ = Describe("machine", func() {
},
},
expect: expect{
err: fmt.Errorf(fmt.Sprintf("Force Drain successful. %s", machineutils.DelVolumesAttachments)),
err: fmt.Errorf("%s", fmt.Sprintf("Force Drain successful. %s", machineutils.DelVolumesAttachments)),
retry: machineutils.ShortRetry,
machine: newMachine(
&v1alpha1.MachineTemplateSpec{
Expand Down Expand Up @@ -2019,7 +2019,7 @@ var _ = Describe("machine", func() {
},
},
expect: expect{
err: fmt.Errorf(fmt.Sprintf("Force Drain successful. %s", machineutils.DelVolumesAttachments)),
err: fmt.Errorf("%s", fmt.Sprintf("Force Drain successful. %s", machineutils.DelVolumesAttachments)),
retry: machineutils.ShortRetry,
machine: newMachine(
&v1alpha1.MachineTemplateSpec{
Expand Down
6 changes: 3 additions & 3 deletions pkg/util/provider/machinecontroller/machine_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ func (c *controller) getVMStatus(ctx context.Context, getMachineStatusRequest *d
state = v1alpha1.MachineStateFailed
retry = machineutils.LongRetry

err = fmt.Errorf("Machine deletion has failed. " + description)
err = fmt.Errorf("Machine deletion has failed. %s", description)
} else {
// Decoding machine error code
switch machineErr.Code() {
Expand Down Expand Up @@ -1199,7 +1199,7 @@ func (c *controller) drainNode(ctx context.Context, deleteMachineRequest *driver
} else { // regular drain already waits for vol detach and attach for another node.
description = fmt.Sprintf("Drain successful. %s", machineutils.InitiateVMDeletion)
}
err = fmt.Errorf(description)
err = fmt.Errorf("%s", description)
state = v1alpha1.MachineStateProcessing

// Return error even when machine object is updated
Expand Down Expand Up @@ -1346,7 +1346,7 @@ func (c *controller) deleteVM(ctx context.Context, deleteMachineRequest *driver.
description = fmt.Sprintf("VM deletion was successful. %s", machineutils.InitiateNodeDeletion)
state = v1alpha1.MachineStateProcessing

err = fmt.Errorf("Machine deletion in process. " + description)
err = fmt.Errorf("Machine deletion in process. %s", description)
}

if deleteMachineResponse != nil && deleteMachineResponse.LastKnownState != "" {
Expand Down

0 comments on commit 69f0290

Please sign in to comment.