From a6570c30dc65eeed4df4569622d600ede3e2c430 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 20 May 2025 12:45:37 +0000 Subject: [PATCH 1/2] chore(deps): update hack/common digest to 80bfca5 --- hack/common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/common b/hack/common index e7e4c91..80bfca5 160000 --- a/hack/common +++ b/hack/common @@ -1 +1 @@ -Subproject commit e7e4c918f5febdbee0e4f0355a3338bc31f70165 +Subproject commit 80bfca5ddf3186e97df6b7d1acdea035f6ba4632 From 3ccf3cce8381d8d8d1e3fde90c513d04653b9f80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Wannenmacher?= Date: Tue, 20 May 2025 15:09:37 +0200 Subject: [PATCH 2/2] chore(fix): golang-lint v2 changes --- .golangci.yaml | 55 +++++++++++++++++++++---- pkg/clientconfig/clientconfig.go | 18 ++++---- pkg/collections/list-linked.go | 2 +- pkg/controller/annotation_label_test.go | 8 ++-- pkg/testing/complex_environment.go | 14 +++---- 5 files changed, 69 insertions(+), 28 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 083aa42..c8f4c2f 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,8 +1,49 @@ +version: "2" run: - concurrency: 4 - timeout: 10m - -issues: - exclude-files: - - "zz_generated.*\\.go$" - - "tmp/.*" + allow-parallel-runners: true +linters: + default: none + enable: + - copyloopvar +# - dupl + - errcheck +# - ginkgolinter +# - goconst + - gocyclo + - govet + - ineffassign + - misspell + - nakedret +# - prealloc +# - revive + - staticcheck + - unconvert + - unparam + - unused + settings: + revive: + rules: + - name: comment-spacings + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - zz_generated.*\.go$ + - tmp/.* + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/pkg/clientconfig/clientconfig.go b/pkg/clientconfig/clientconfig.go index 5a73b23..462db76 100644 --- a/pkg/clientconfig/clientconfig.go +++ b/pkg/clientconfig/clientconfig.go @@ -237,15 +237,15 @@ func copyRestConfig(from, to *rest.Config) { to.AuthProvider = from.AuthProvider to.AuthConfigPersister = from.AuthConfigPersister to.ExecProvider = from.ExecProvider - to.TLSClientConfig.Insecure = from.TLSClientConfig.Insecure - to.TLSClientConfig.ServerName = from.TLSClientConfig.ServerName - to.TLSClientConfig.CertFile = from.TLSClientConfig.CertFile - to.TLSClientConfig.KeyFile = from.TLSClientConfig.KeyFile - to.TLSClientConfig.CAFile = from.TLSClientConfig.CAFile - to.TLSClientConfig.CertData = from.TLSClientConfig.CertData - to.TLSClientConfig.KeyData = from.TLSClientConfig.KeyData - to.TLSClientConfig.CAData = from.TLSClientConfig.CAData - to.TLSClientConfig.NextProtos = from.TLSClientConfig.NextProtos + to.Insecure = from.Insecure + to.ServerName = from.ServerName + to.CertFile = from.CertFile + to.KeyFile = from.KeyFile + to.CAFile = from.CAFile + to.CertData = from.CertData + to.KeyData = from.KeyData + to.CAData = from.CAData + to.NextProtos = from.NextProtos to.UserAgent = from.UserAgent to.DisableCompression = from.DisableCompression to.Transport = from.Transport diff --git a/pkg/collections/list-linked.go b/pkg/collections/list-linked.go index 5ba997e..0e897b9 100644 --- a/pkg/collections/list-linked.go +++ b/pkg/collections/list-linked.go @@ -40,7 +40,7 @@ func NewLinkedList[T any](elements ...T) *LinkedList[T] { res.dummy.next = res.dummy res.dummy.prev = res.dummy - res.abstractCollection.funcIterator = res.Iterator + res.funcIterator = res.Iterator res.funcAdd = res.Add res.funcClear = res.Clear res.funcRemove = res.Remove diff --git a/pkg/controller/annotation_label_test.go b/pkg/controller/annotation_label_test.go index 801f6c8..24f5821 100644 --- a/pkg/controller/annotation_label_test.go +++ b/pkg/controller/annotation_label_test.go @@ -20,12 +20,12 @@ var _ = Describe("Annotation/Label Library", func() { Context("IsMetadataEntryAlreadyExistsError", func() { It("should return true if the error is of type IsMetadataEntryAlreadyExistsError", func() { - var err error = ctrlutils.NewMetadataEntryAlreadyExistsError(ctrlutils.ANNOTATION, "test-annotation", "desired-value", "actual-value") + err := ctrlutils.NewMetadataEntryAlreadyExistsError(ctrlutils.ANNOTATION, "test-annotation", "desired-value", "actual-value") Expect(ctrlutils.IsMetadataEntryAlreadyExistsError(err)).To(BeTrue()) }) It("should return false if the error is not of type IsMetadataEntryAlreadyExistsError", func() { - var err error = fmt.Errorf("test-error") + err := fmt.Errorf("test-error") Expect(ctrlutils.IsMetadataEntryAlreadyExistsError(err)).To(BeFalse()) }) @@ -213,12 +213,12 @@ var _ = Describe("Annotation/Label Library", func() { Context("IsMetadataEntryAlreadyExistsError", func() { It("should return true if the error is of type IsMetadataEntryAlreadyExistsError", func() { - var err error = ctrlutils.NewMetadataEntryAlreadyExistsError(ctrlutils.LABEL, "test-label", "desired-value", "actual-value") + err := ctrlutils.NewMetadataEntryAlreadyExistsError(ctrlutils.LABEL, "test-label", "desired-value", "actual-value") Expect(ctrlutils.IsMetadataEntryAlreadyExistsError(err)).To(BeTrue()) }) It("should return false if the error is not of type IsMetadataEntryAlreadyExistsError", func() { - var err error = fmt.Errorf("test-error") + err := fmt.Errorf("test-error") Expect(ctrlutils.IsMetadataEntryAlreadyExistsError(err)).To(BeFalse()) }) diff --git a/pkg/testing/complex_environment.go b/pkg/testing/complex_environment.go index 2bc0f5f..2b42e4c 100644 --- a/pkg/testing/complex_environment.go +++ b/pkg/testing/complex_environment.go @@ -7,7 +7,7 @@ import ( "reflect" "time" - . "github.com/onsi/gomega" + "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" ctrl "sigs.k8s.io/controller-runtime" @@ -61,7 +61,7 @@ func (e *ComplexEnvironment) ShouldReconcile(reconciler string, req reconcile.Re func (e *ComplexEnvironment) shouldReconcile(reconciler string, req reconcile.Request, optionalDescription ...interface{}) reconcile.Result { res, err := e.Reconcilers[reconciler].Reconcile(e.Ctx, req) - ExpectWithOffset(2, err).ToNot(HaveOccurred(), optionalDescription...) + gomega.ExpectWithOffset(2, err).ToNot(gomega.HaveOccurred(), optionalDescription...) return res } @@ -73,10 +73,10 @@ func (e *ComplexEnvironment) ShouldEventuallyReconcile(reconciler string, req re func (e *ComplexEnvironment) shouldEventuallyReconcile(reconciler string, req reconcile.Request, timeout, poll time.Duration, optionalDescription ...interface{}) reconcile.Result { var err error var res reconcile.Result - EventuallyWithOffset(1, func() error { + gomega.EventuallyWithOffset(1, func() error { res, err = e.Reconcilers[reconciler].Reconcile(e.Ctx, req) return err - }, timeout, poll).Should(Succeed(), optionalDescription...) + }, timeout, poll).Should(gomega.Succeed(), optionalDescription...) return res } @@ -87,7 +87,7 @@ func (e *ComplexEnvironment) ShouldNotReconcile(reconciler string, req reconcile func (e *ComplexEnvironment) shouldNotReconcile(reconciler string, req reconcile.Request, optionalDescription ...interface{}) reconcile.Result { res, err := e.Reconcilers[reconciler].Reconcile(e.Ctx, req) - ExpectWithOffset(2, err).To(HaveOccurred(), optionalDescription...) + gomega.ExpectWithOffset(2, err).To(gomega.HaveOccurred(), optionalDescription...) return res } @@ -99,10 +99,10 @@ func (e *ComplexEnvironment) ShouldEventuallyNotReconcile(reconciler string, req func (e *ComplexEnvironment) shouldEventuallyNotReconcile(reconciler string, req reconcile.Request, timeout, poll time.Duration, optionalDescription ...interface{}) reconcile.Result { var err error var res reconcile.Result - EventuallyWithOffset(1, func() error { + gomega.EventuallyWithOffset(1, func() error { res, err = e.Reconcilers[reconciler].Reconcile(e.Ctx, req) return err - }, timeout, poll).ShouldNot(Succeed(), optionalDescription...) + }, timeout, poll).ShouldNot(gomega.Succeed(), optionalDescription...) return res }