Skip to content

Commit 4898043

Browse files
committed
Fix go lint errors
1 parent a38725b commit 4898043

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ jobs:
1111
name: lint
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
15-
- uses: actions/setup-go@v3
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-go@v5
1616
with:
17-
go-version: '1.22'
17+
go-version: '1.24'
1818
check-latest: true
1919
cache: true
2020
- name: golangci-lint
21-
uses: golangci/golangci-lint-action@v3
21+
uses: golangci/golangci-lint-action@v8
2222
with:
23-
version: v1.55.2
23+
version: v2.1.0
2424
# Disable package caching to avoid a double cache with setup-go.
2525
skip-pkg-cache: true
2626
args: --timeout 10m

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ bin
1919

2020
# editor and IDE paraphernalia
2121
.idea
22+
.vscode
2223
*.swp
2324
*.swo
2425
*~

.golangci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
version: "2"
2+
13
run:
24
timeout: 10m
3-
skip-dirs:
4-
- "api/v1alpha3"
5+
6+
linters:
7+
disable:
8+
- staticcheck

controllers/healthcheck.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (r *EtcdadmClusterReconciler) performEndpointHealthCheck(ctx context.Contex
6363
return errors.Wrap(err, "error checking etcd member health")
6464
}
6565
// reuse connection
66-
defer resp.Body.Close()
66+
defer func() { _ = resp.Body.Close() }()
6767

6868
if resp.StatusCode != http.StatusOK {
6969
return errors.Wrap(err, "Etcd member not ready, retry")
@@ -136,7 +136,7 @@ func isPortOpen(ctx context.Context, endpoint string) bool {
136136
}
137137

138138
if conn != nil {
139-
conn.Close()
139+
_ = conn.Close()
140140
return true
141141
}
142142

controllers/periodic_healthcheck.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func (r *EtcdadmClusterReconciler) periodicEtcdMembersHealthCheck(ctx context.Co
127127
log := r.Log.WithValues("EtcdadmCluster", klog.KObj(etcdCluster))
128128

129129
if etcdCluster.Spec.Replicas == nil {
130-
err := fmt.Errorf("Replicas is nil")
130+
err := fmt.Errorf("replicas is nil")
131131
log.Error(err, "Error performing healthcheck")
132132
return err
133133
}

controllers/scale.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (r *EtcdadmClusterReconciler) removeEtcdMachine(ctx context.Context, ec *et
5555
if etcdClient == nil {
5656
return fmt.Errorf("could not create etcd client")
5757
}
58-
defer etcdClient.Close()
58+
defer func() { _ = etcdClient.Close() }()
5959

6060
return r.removeEtcdMemberAndDeleteMachine(ctx, etcdClient, peerURL, machineToDelete)
6161

0 commit comments

Comments
 (0)