Skip to content

Commit 321cc1d

Browse files
chore(deps): bump golangci/golangci-lint-action from 6 to 8 (#1311)
* chore(deps): bump golangci/golangci-lint-action from 6 to 7 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6 to 7. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](golangci/golangci-lint-action@v6...v7) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * update golangci lint Signed-off-by: yangw <[email protected]> * update version Signed-off-by: yangw <[email protected]> * upgrade yaml Signed-off-by: yangw <[email protected]> * remove useless Signed-off-by: yangw <[email protected]> * fix lint Signed-off-by: yangw <[email protected]> * fix lint Signed-off-by: yangw <[email protected]> * fixlint Signed-off-by: yangw <[email protected]> * fix test Signed-off-by: yangw <[email protected]> * fix lint Signed-off-by: yangw <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: yangw <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: yangw <[email protected]>
1 parent 55eaf44 commit 321cc1d

File tree

24 files changed

+214
-206
lines changed

24 files changed

+214
-206
lines changed

.github/workflows/ci.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ jobs:
2929
go-version: ${{ env.GOLANG_VERSION }}
3030
cache: false
3131

32+
- name: Get golangci-lint version from Makefile
33+
run: |
34+
GOLANGCI_VERSION=$(grep '^GOLANGCI_LINT_VERSION' Makefile | cut -d'=' -f2 | tr -d ' ?')
35+
echo "GOLANGCI_LINT_VERSION=$GOLANGCI_VERSION" >> $GITHUB_ENV
36+
3237
- name: Run GolangCI-Lint
33-
uses: golangci/golangci-lint-action@v6
38+
uses: golangci/golangci-lint-action@v8
3439
with:
35-
version: v1.62.2
40+
version: ${{ env.GOLANGCI_LINT_VERSION }}
3641

3742
gotest:
3843
needs:

.golangci.yml

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
linters-settings:
2-
gofmt:
3-
simplify: true
4-
1+
version: "2"
2+
run:
3+
go: 1.23.4
4+
tests: true
55
linters:
66
enable:
77
- asasalint
@@ -12,38 +12,43 @@ linters:
1212
- decorder
1313
- dogsled
1414
- durationcheck
15-
- errcheck
1615
- errname
17-
- gci
1816
- gochecknoinits
19-
- gofmt
20-
- gofumpt
2117
- goprintffuncname
22-
- gosimple
23-
- govet
2418
- grouper
2519
- importas
26-
- ineffassign
2720
- makezero
2821
- misspell
2922
- noctx
3023
- nolintlint
3124
- nosprintfhostport
32-
- staticcheck
33-
- tenv
3425
- thelper
3526
- tparallel
3627
- unconvert
37-
- unused
3828
- wastedassign
3929
- whitespace
40-
41-
run:
42-
timeout: 15m
43-
go: "1.23.4"
44-
tests: true
45-
46-
output:
47-
sort-results: true
48-
print-linter-name: true
49-
print-issued-lines: true
30+
exclusions:
31+
generated: lax
32+
presets:
33+
- comments
34+
- common-false-positives
35+
- legacy
36+
- std-error-handling
37+
paths:
38+
- third_party$
39+
- builtin$
40+
- examples$
41+
formatters:
42+
enable:
43+
- gci
44+
- gofmt
45+
- gofumpt
46+
settings:
47+
gofmt:
48+
simplify: true
49+
exclusions:
50+
generated: lax
51+
paths:
52+
- third_party$
53+
- builtin$
54+
- examples$

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ KIND = $(LOCALBIN)/kind-$(KIND_VERSION)
4646
KUSTOMIZE_VERSION ?= v5.6.0
4747
CONTROLLER_TOOLS_VERSION ?= v0.17.2
4848
ENVTEST_VERSION ?= release-0.17
49-
GOLANGCI_LINT_VERSION ?= v1.57.2
49+
GOLANGCI_LINT_VERSION ?= v2.2.2
5050
KUTTL_VERSION ?= 0.15.0
5151
KIND_VERSION ?= v0.24.0
5252

internal/controller/redis/redis_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ type Reconciler struct {
4343
func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
4444
instance := &rvb2.Redis{}
4545

46-
err := r.Client.Get(context.TODO(), req.NamespacedName, instance)
46+
err := r.Get(context.TODO(), req.NamespacedName, instance)
4747
if err != nil {
4848
return intctrlutil.RequeueECheck(ctx, err, "failed to get redis instance")
4949
}
50-
if instance.ObjectMeta.GetDeletionTimestamp() != nil {
50+
if instance.GetDeletionTimestamp() != nil {
5151
if err = k8sutils.HandleRedisFinalizer(ctx, r.Client, instance, RedisFinalizer); err != nil {
5252
return intctrlutil.RequeueE(ctx, err, "failed to handle redis finalizer")
5353
}

internal/controller/rediscluster/rediscluster_controller.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
5656
logger := log.FromContext(ctx)
5757
instance := &rcvb2.RedisCluster{}
5858

59-
err := r.Client.Get(context.TODO(), req.NamespacedName, instance)
59+
err := r.Get(context.TODO(), req.NamespacedName, instance)
6060
if err != nil {
6161
return intctrlutil.RequeueECheck(ctx, err, "failed to get redis cluster instance")
6262
}
63-
if instance.ObjectMeta.GetDeletionTimestamp() != nil {
63+
if instance.GetDeletionTimestamp() != nil {
6464
if err = k8sutils.HandleRedisClusterFinalizer(ctx, r.Client, instance, RedisClusterFinalizer); err != nil {
6565
return intctrlutil.RequeueE(ctx, err, "failed to handle redis cluster finalizer")
6666
}
@@ -83,7 +83,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
8383

8484
// Check if the cluster is downscaled
8585
if leaderCount := r.GetStatefulSetReplicas(ctx, instance.Namespace, instance.Name+"-leader"); leaderReplicas < leaderCount {
86-
if !(r.IsStatefulSetReady(ctx, instance.Namespace, instance.Name+"-leader") && r.IsStatefulSetReady(ctx, instance.Namespace, instance.Name+"-follower")) {
86+
if !r.IsStatefulSetReady(ctx, instance.Namespace, instance.Name+"-leader") || !r.IsStatefulSetReady(ctx, instance.Namespace, instance.Name+"-follower") {
8787
return intctrlutil.Reconciled()
8888
}
8989
if masterCount := k8sutils.CheckRedisNodeCount(ctx, r.K8sClient, instance, "leader"); masterCount == leaderCount {
@@ -178,12 +178,12 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
178178
}
179179
}
180180

181-
if !(r.IsStatefulSetReady(ctx, instance.Namespace, instance.Name+"-leader") && r.IsStatefulSetReady(ctx, instance.Namespace, instance.Name+"-follower")) {
181+
if !r.IsStatefulSetReady(ctx, instance.Namespace, instance.Name+"-leader") || !r.IsStatefulSetReady(ctx, instance.Namespace, instance.Name+"-follower") {
182182
return intctrlutil.Reconciled()
183183
}
184184

185185
// Mark the cluster status as bootstrapping if all the leader and follower nodes are ready
186-
if !(instance.Status.ReadyLeaderReplicas == leaderReplicas && instance.Status.ReadyFollowerReplicas == followerReplicas) {
186+
if instance.Status.ReadyLeaderReplicas != leaderReplicas || instance.Status.ReadyFollowerReplicas != followerReplicas {
187187
err = k8sutils.UpdateRedisClusterStatus(ctx, instance, rcvb2.RedisClusterBootstrap, rcvb2.BootstrapClusterReason, leaderReplicas, followerReplicas, r.Client)
188188
if err != nil {
189189
return intctrlutil.RequeueE(ctx, err, "")

internal/controller/redisreplication/redisreplication_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type Reconciler struct {
3232
func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
3333
instance := &rrvb2.RedisReplication{}
3434

35-
err := r.Client.Get(ctx, req.NamespacedName, instance)
35+
err := r.Get(ctx, req.NamespacedName, instance)
3636
if err != nil {
3737
return intctrlutil.RequeueECheck(ctx, err, "failed to get RedisReplication instance")
3838
}

internal/controller/redissentinel/redissentinel_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type RedisSentinelReconciler struct {
3535
func (r *RedisSentinelReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
3636
instance := &rsvb2.RedisSentinel{}
3737

38-
err := r.Client.Get(ctx, req.NamespacedName, instance)
38+
err := r.Get(ctx, req.NamespacedName, instance)
3939
if err != nil {
4040
return intctrlutil.RequeueECheck(ctx, err, "failed to get RedisSentinel instance")
4141
}

internal/controller/testutil/skip_reconcile_test_helper.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"context"
55
"time"
66

7-
. "github.com/onsi/ginkgo/v2"
8-
. "github.com/onsi/gomega"
7+
ginkgo "github.com/onsi/ginkgo/v2"
8+
gomega "github.com/onsi/gomega"
99
appsv1 "k8s.io/api/apps/v1"
1010
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1111
"k8s.io/apimachinery/pkg/types"
@@ -38,27 +38,27 @@ func RunSkipReconcileTest(k8sClient client.Client, config SkipReconcileTestConfi
3838
annotations[config.SkipAnnotationKey] = "true"
3939
config.Object.SetAnnotations(annotations)
4040

41-
Expect(k8sClient.Create(context.Background(), config.Object)).Should(Succeed())
41+
gomega.Expect(k8sClient.Create(context.Background(), config.Object)).Should(gomega.Succeed())
4242
defer func() {
43-
Expect(k8sClient.Delete(context.Background(), config.Object)).Should(Succeed())
43+
gomega.Expect(k8sClient.Delete(context.Background(), config.Object)).Should(gomega.Succeed())
4444
}()
4545

46-
By("verifying that no StatefulSet is created when skip-reconcile is true")
46+
ginkgo.By("verifying that no StatefulSet is created when skip-reconcile is true")
4747
sts := &appsv1.StatefulSet{}
48-
Consistently(func() error {
48+
gomega.Consistently(func() error {
4949
return k8sClient.Get(context.Background(), types.NamespacedName{
5050
Name: config.StatefulSetName,
5151
Namespace: config.Namespace,
5252
}, sts)
53-
}, time.Second*3, time.Millisecond*500).ShouldNot(Succeed())
53+
}, time.Second*3, time.Millisecond*500).ShouldNot(gomega.Succeed())
5454

55-
By("updating skip-reconcile annotation to false")
55+
ginkgo.By("updating skip-reconcile annotation to false")
5656
// Get the updated object from cluster
5757
updatedObj := config.Object.DeepCopyObject().(client.Object)
58-
Expect(k8sClient.Get(context.Background(), types.NamespacedName{
58+
gomega.Expect(k8sClient.Get(context.Background(), types.NamespacedName{
5959
Name: config.Object.GetName(),
6060
Namespace: config.Namespace,
61-
}, updatedObj)).Should(Succeed())
61+
}, updatedObj)).Should(gomega.Succeed())
6262

6363
// Update the annotation
6464
annotations = updatedObj.GetAnnotations()
@@ -67,15 +67,15 @@ func RunSkipReconcileTest(k8sClient client.Client, config SkipReconcileTestConfi
6767
}
6868
annotations[config.SkipAnnotationKey] = "false"
6969
updatedObj.SetAnnotations(annotations)
70-
Expect(k8sClient.Update(context.Background(), updatedObj)).Should(Succeed())
70+
gomega.Expect(k8sClient.Update(context.Background(), updatedObj)).Should(gomega.Succeed())
7171

72-
By("verifying that StatefulSet is created after skip-reconcile is set to false")
73-
Eventually(func() error {
72+
ginkgo.By("verifying that StatefulSet is created after skip-reconcile is set to false")
73+
gomega.Eventually(func() error {
7474
return k8sClient.Get(context.Background(), types.NamespacedName{
7575
Name: config.StatefulSetName,
7676
Namespace: config.Namespace,
7777
}, sts)
78-
}, config.Timeout, config.Interval).Should(Succeed())
78+
}, config.Timeout, config.Interval).Should(gomega.Succeed())
7979
}
8080

8181
// CreateTestObject creates a test object with the given name, namespace and annotations

0 commit comments

Comments
 (0)