Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 48 additions & 7 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -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$
2 changes: 1 addition & 1 deletion hack/common
18 changes: 9 additions & 9 deletions pkg/clientconfig/clientconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/collections/list-linked.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/annotation_label_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})

Expand Down Expand Up @@ -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())
})

Expand Down
14 changes: 7 additions & 7 deletions pkg/testing/complex_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}

Expand All @@ -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
}

Expand All @@ -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
}

Expand All @@ -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
}

Expand Down