Skip to content

Commit d76c473

Browse files
committed
Satisfy the linter
Signed-off-by: Timofei Larkin <[email protected]>
1 parent 92c9f35 commit d76c473

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

internal/controller/etcdcluster_controller.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,12 @@ func (r *EtcdClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
113113
}
114114
defer func() {
115115
if clusterClient != nil {
116+
// nolint:errcheck
116117
clusterClient.Close()
117118
}
118119
for i := range singleClients {
119120
if singleClients[i] != nil {
121+
// nolint:errcheck
120122
singleClients[i].Close()
121123
}
122124
}
@@ -296,6 +298,8 @@ func (r *EtcdClusterReconciler) ensureConditionalClusterObjects(
296298
}
297299

298300
// updateStatusOnErr wraps error and updates EtcdCluster status
301+
// TODO: refactor this so the linter doesn't complain
302+
// nolint:unparam
299303
func (r *EtcdClusterReconciler) updateStatusOnErr(ctx context.Context, cluster *etcdaenixiov1alpha1.EtcdCluster, err error) (ctrl.Result, error) {
300304
// The function 'updateStatusOnErr' will always return non-nil error. Hence, the ctrl.Result will always be ignored.
301305
// Therefore, the ctrl.Result returned by 'updateStatus' function can be discarded.
@@ -351,9 +355,8 @@ func (r *EtcdClusterReconciler) configureAuth(ctx context.Context, cluster *etcd
351355
return err
352356
}
353357

354-
defer func() {
355-
err = cli.Close()
356-
}()
358+
// nolint:errcheck
359+
defer cli.Close()
357360

358361
err = testMemberList(ctx, cli)
359362
if err != nil {

internal/controller/factory/etcd_client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func NewEtcdClientSet(ctx context.Context, cluster *v1alpha1.EtcdCluster, cli cl
3333
cfg.Endpoints = []string{ep}
3434
singleClients[i], err = clientv3.New(cfg)
3535
if err != nil {
36+
// nolint:errcheck
3637
clusterClient.Close()
3738
return nil, nil, fmt.Errorf("error building etcd single-endpoint client for endpoint %s: %w", ep, err)
3839
}

0 commit comments

Comments
 (0)