Skip to content

Commit

Permalink
Evaludate and Apply Latest Lint Rules and Features
Browse files Browse the repository at this point in the history
Signed-off-by: Prashant Rewar <108176843+prashantrewar@users.noreply.github.com>
  • Loading branch information
prashantrewar committed Apr 19, 2024
1 parent 72586d3 commit 6e66b1d
Show file tree
Hide file tree
Showing 179 changed files with 44 additions and 342 deletions.
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ linters-settings:
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
arguments:
# dot import should be ONLY allowed for ginkgo testing packages
allowedPackages:
- "github.com/onsi/ginkgo/v2"
- "github.com/onsi/gomega"
- name: error-return
- name: error-strings
- name: error-naming
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import (
"fmt"
"testing"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import (
"os/exec"
"time"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

"tutorial.kubebuilder.io/project/test/utils"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"os/exec"
"strings"

// nolint:revive
. "github.com/onsi/ginkgo/v2" //nolint:golint,revive
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package v1

import (
// nolint:revive
. "github.com/onsi/ginkgo/v2"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ import (
"testing"
"time"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
admissionv1 "k8s.io/api/admission/v1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ import (
"reflect"
"time"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
batchv1 "k8s.io/api/batch/v1"
v1 "k8s.io/api/core/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Kubebuilder scaffolded a `internal/controller/suite_test.go` file that does the
First, it will contain the necessary imports.
*/


package controller

import (
Expand All @@ -34,9 +33,7 @@ import (

ctrl "sigs.k8s.io/controller-runtime"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

"k8s.io/client-go/kubernetes/scheme"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import (
"fmt"
"testing"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import (
"os/exec"
"time"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

"tutorial.kubebuilder.io/project/test/utils"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"os/exec"
"strings"

// nolint:revive
. "github.com/onsi/ginkgo/v2" //nolint:golint,revive
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ import (
"time"

//nolint:golint
// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ import (
"runtime"
"testing"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

"k8s.io/client-go/kubernetes/scheme"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import (
"fmt"
"testing"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import (
"os/exec"
"time"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

"example.com/memcached/test/utils"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"os/exec"
"strings"

// nolint:revive
. "github.com/onsi/ginkgo/v2" //nolint:golint,revive
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package v1

import (
// nolint:revive
. "github.com/onsi/ginkgo/v2"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ import (
"testing"
"time"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

admissionv1 "k8s.io/api/admission/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ import (
"testing"
"time"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

admissionv1 "k8s.io/api/admission/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ import (

ctrl "sigs.k8s.io/controller-runtime"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

"k8s.io/client-go/kubernetes/scheme"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import (
"fmt"
"testing"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import (
"os/exec"
"time"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

"tutorial.kubebuilder.io/project/test/utils"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"os/exec"
"strings"

// nolint:revive
. "github.com/onsi/ginkgo/v2" //nolint:golint,revive
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ import (
"reflect"
"time"
// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
batchv1 "k8s.io/api/batch/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
2 changes: 0 additions & 2 deletions pkg/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ import (
"os"
"strings"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
"github.com/spf13/afero"
"github.com/spf13/cobra"
Expand Down
2 changes: 0 additions & 2 deletions pkg/cli/completion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ limitations under the License.
package cli

import (
// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 0 additions & 2 deletions pkg/cli/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ import (
"path/filepath"
"runtime"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
"github.com/spf13/afero"
"github.com/spf13/cobra"
Expand Down
2 changes: 0 additions & 2 deletions pkg/cli/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ limitations under the License.
package cli

import (
// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

"sigs.k8s.io/kubebuilder/v3/pkg/model/resource"
Expand Down
2 changes: 0 additions & 2 deletions pkg/cli/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ package cli
import (
"testing"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

"sigs.k8s.io/kubebuilder/v3/pkg/config"
Expand Down
2 changes: 0 additions & 2 deletions pkg/cli/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ limitations under the License.
package cli

import (
// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 0 additions & 2 deletions pkg/config/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ package config
import (
"fmt"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

"sigs.k8s.io/kubebuilder/v3/pkg/model/resource"
Expand Down
2 changes: 0 additions & 2 deletions pkg/config/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ limitations under the License.
package config

import (
// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 0 additions & 2 deletions pkg/config/store/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import (
"fmt"
"testing"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 0 additions & 2 deletions pkg/config/store/yaml/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import (
"os"
"testing"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
"github.com/spf13/afero"

Expand Down
2 changes: 0 additions & 2 deletions pkg/config/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ package config
import (
"testing"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 0 additions & 2 deletions pkg/config/v2/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ package v2
import (
"testing"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

"sigs.k8s.io/kubebuilder/v3/pkg/model/resource"
Expand Down
2 changes: 0 additions & 2 deletions pkg/config/v3/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import (
"sort"
"testing"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

"sigs.k8s.io/kubebuilder/v3/pkg/config"
Expand Down
2 changes: 0 additions & 2 deletions pkg/config/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ package config
import (
"sort"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"

"sigs.k8s.io/kubebuilder/v3/pkg/model/stage"
Expand Down
2 changes: 0 additions & 2 deletions pkg/internal/validation/dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import (
"strings"
"testing"

// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
)

Expand Down
Loading

0 comments on commit 6e66b1d

Please sign in to comment.