Skip to content

Commit ccd11ee

Browse files
committed
fix golangci reported issuers
Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
1 parent 2f14f27 commit ccd11ee

11 files changed

Lines changed: 24 additions & 23 deletions

File tree

controllers/client/openstackclient_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ func (r *OpenStackClientReconciler) Reconcile(ctx context.Context, req ctrl.Requ
266266
condition.TLSInputReadyCondition,
267267
condition.RequestedReason,
268268
condition.SeverityInfo,
269-
fmt.Sprintf(condition.TLSInputReadyWaitingMessage, instance.Spec.CaBundleSecretName)))
269+
condition.TLSInputReadyWaitingMessage,
270+
instance.Spec.CaBundleSecretName))
270271
return ctrl.Result{}, nil
271272
}
272273
instance.Status.Conditions.Set(condition.FalseCondition(

controllers/dataplane/openstackdataplanedeployment_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func (r *OpenStackDataPlaneDeploymentReconciler) Reconcile(ctx context.Context,
338338
severity,
339339
condition.DeploymentReadyErrorMessage,
340340
deploymentErrMsg)
341-
return ctrl.Result{}, fmt.Errorf(deploymentErrMsg)
341+
return ctrl.Result{}, fmt.Errorf("%s", deploymentErrMsg)
342342
}
343343

344344
if shouldRequeue {

controllers/dataplane/openstackdataplanenodeset_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
276276
condition.InputReadyCondition,
277277
condition.RequestedReason,
278278
condition.SeverityError,
279-
err.Error())
279+
"%s", err.Error())
280280
return result, err
281281
} else if (result != ctrl.Result{}) {
282282
instance.Status.Conditions.MarkFalse(
@@ -455,7 +455,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
455455
}
456456
instance.Status.Conditions.MarkFalse(condition.DeploymentReadyCondition,
457457
condition.ErrorReason, condition.SeverityError,
458-
deployErrorMsg)
458+
"%s", deployErrorMsg)
459459
}
460460

461461
return ctrl.Result{}, err
@@ -505,7 +505,7 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
505505
instance.Status.DeploymentStatuses[deployment.Name] = deploymentConditions
506506
deploymentCondition := deploymentConditions.Get(dataplanev1.NodeSetDeploymentReadyCondition)
507507
if condition.IsError(deploymentCondition) {
508-
err = fmt.Errorf(deploymentCondition.Message)
508+
err = fmt.Errorf("%s", deploymentCondition.Message)
509509
isDeploymentFailed = true
510510
failedDeploymentName = deployment.Name
511511
break

pkg/dataplane/deployment.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func (d *Deployer) ConditionalDeploy(
207207
readyCondition,
208208
condition.RequestedReason,
209209
condition.SeverityInfo,
210-
readyWaitingMessage))
210+
"%s", readyWaitingMessage))
211211

212212
}
213213

@@ -234,7 +234,7 @@ func (d *Deployer) ConditionalDeploy(
234234
log.Info(fmt.Sprintf("Condition %s ready", readyCondition))
235235
nsConditions.Set(condition.TrueCondition(
236236
readyCondition,
237-
readyMessage))
237+
"%s", readyMessage))
238238
} else if ansibleJob.Status.Failed > *ansibleJob.Spec.BackoffLimit {
239239
errorMsg := fmt.Sprintf("execution.name %s execution.namespace %s failed pods: %d", ansibleJob.Name, ansibleJob.Namespace, ansibleJob.Status.Failed)
240240
for _, condition := range ansibleJob.Status.Conditions {
@@ -246,7 +246,7 @@ func (d *Deployer) ConditionalDeploy(
246246
errorMsg = fmt.Sprintf("backoff limit reached for execution.name %s execution.namespace %s execution.condition.message: %s", ansibleJob.Name, ansibleJob.Namespace, ansibleCondition.Message)
247247
}
248248
log.Info(fmt.Sprintf("Condition %s error", readyCondition))
249-
err = fmt.Errorf(errorMsg)
249+
err = fmt.Errorf("%s", errorMsg)
250250
nsConditions.Set(condition.FalseCondition(
251251
readyCondition,
252252
condition.Reason(ansibleCondition.Reason),
@@ -259,7 +259,7 @@ func (d *Deployer) ConditionalDeploy(
259259
readyCondition,
260260
condition.RequestedReason,
261261
condition.SeverityInfo,
262-
readyWaitingMessage))
262+
"%s", readyWaitingMessage))
263263
}
264264
}
265265
d.Status.NodeSetConditions[d.NodeSet.Name] = nsConditions

pkg/dataplane/ipam.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func EnsureDNSData(ctx context.Context, helper *helper.Helper,
198198
instance.Status.Conditions.MarkFalse(
199199
dataplanev1.NodeSetDNSDataReadyCondition,
200200
condition.ErrorReason, condition.SeverityError,
201-
err.Error())
201+
"%s", err.Error())
202202
return dnsDetails, err
203203
}
204204
if dnsDetails.ClusterAddresses == nil {
@@ -348,7 +348,7 @@ func reserveIPs(ctx context.Context, helper *helper.Helper,
348348
if len(netConfigList.Items) == 0 {
349349
errMsg := "no NetConfig CR exists yet"
350350
util.LogForObject(helper, errMsg, instance)
351-
return nil, nil, fmt.Errorf(errMsg)
351+
return nil, nil, fmt.Errorf("%s", errMsg)
352352
}
353353
netServiceNetMap := BuildNetServiceNetMap(netConfigList.Items[0])
354354
allIPSets := make(map[string]infranetworkv1.IPSet)
@@ -371,7 +371,7 @@ func reserveIPs(ctx context.Context, helper *helper.Helper,
371371
}
372372
if !foundCtlPlane {
373373
msg := fmt.Sprintf("ctlplane network should be defined for node %s", nodeName)
374-
return nil, netServiceNetMap, fmt.Errorf(msg)
374+
return nil, netServiceNetMap, fmt.Errorf("%s", msg)
375375
}
376376
ipSet := &infranetworkv1.IPSet{
377377
ObjectMeta: metav1.ObjectMeta{
@@ -395,7 +395,7 @@ func reserveIPs(ctx context.Context, helper *helper.Helper,
395395
} else {
396396
msg := fmt.Sprintf("No Networks defined for node %s or template", nodeName)
397397
util.LogForObject(helper, msg, instance)
398-
return nil, netServiceNetMap, fmt.Errorf(msg)
398+
return nil, netServiceNetMap, fmt.Errorf("%s", msg)
399399
}
400400
}
401401
return allIPSets, netServiceNetMap, nil

pkg/dataplane/util/ansibleee.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (a *EEJob) JobForOpenStackAnsibleEE(h *helper.Helper) (*batchv1.Job, error)
111111
}},
112112
}
113113

114-
if a.NodeSelector != nil && len(a.NodeSelector) > 0 {
114+
if len(a.NodeSelector) > 0 {
115115
podSpec.NodeSelector = a.NodeSelector
116116
}
117117

pkg/openstack/galera.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func ReconcileGaleras(
174174
corev1beta1.OpenStackControlPlaneMariaDBReadyErrorMessage,
175175
errors))
176176

177-
return ctrl.Result{}, fmt.Errorf(errors)
177+
return ctrl.Result{}, fmt.Errorf("%s", errors)
178178

179179
} else if len(inprogress) > 0 {
180180
log.Info("Galera in progress")

pkg/openstack/memcached.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func ReconcileMemcacheds(
119119
corev1beta1.OpenStackControlPlaneMemcachedReadyErrorMessage,
120120
errors))
121121

122-
return ctrlResult, fmt.Errorf(errors)
122+
return ctrlResult, fmt.Errorf("%s", errors)
123123

124124
} else if len(inprogress) > 0 {
125125
instance.Status.Conditions.Set(condition.FalseCondition(

pkg/openstack/rabbitmq.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func ReconcileRabbitMQs(
128128
corev1beta1.OpenStackControlPlaneRabbitMQReadyErrorMessage,
129129
errors))
130130

131-
return ctrl.Result{}, fmt.Errorf(errors)
131+
return ctrl.Result{}, fmt.Errorf("%s", errors)
132132

133133
} else if len(inprogress) > 0 {
134134
instance.Status.Conditions.Set(condition.FalseCondition(
@@ -259,7 +259,7 @@ func reconcileRabbitMQ(
259259
op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), rabbitmq, func() error {
260260
spec.DeepCopyInto(&rabbitmq.Spec.RabbitMqSpecCore)
261261
if rabbitmq.Spec.Persistence.StorageClassName == nil {
262-
log.Info(fmt.Sprintf("Setting StorageClassName: " + instance.Spec.StorageClass))
262+
log.Info(fmt.Sprintf("Setting StorageClassName: %s", instance.Spec.StorageClass))
263263
rabbitmq.Spec.Persistence.StorageClassName = &instance.Spec.StorageClass
264264
}
265265
if tlsCert != "" {

pkg/openstack/redis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func ReconcileRedis(
134134
corev1beta1.OpenStackControlPlaneRedisReadyErrorMessage,
135135
errors))
136136

137-
return ctrlResult, fmt.Errorf(errors)
137+
return ctrlResult, fmt.Errorf("%s", errors)
138138

139139
} else if len(inprogress) > 0 {
140140
instance.Status.Conditions.Set(condition.FalseCondition(

0 commit comments

Comments
 (0)