Skip to content

Commit 1bdc798

Browse files
authored
Merge pull request #3866 from prashantrewar/apply-latest-lint-rules
🌱Evaludate and Apply Latest Lint Rules and Features
2 parents 8847d19 + 5194900 commit 1bdc798

File tree

179 files changed

+58
-356
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+58
-356
lines changed

.golangci.yml

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ linters-settings:
2626
- name: context-as-argument
2727
- name: context-keys-type
2828
- name: dot-imports
29+
arguments:
30+
# dot import should be ONLY allowed for ginkgo testing packages
31+
allowedPackages:
32+
- "github.com/onsi/ginkgo/v2"
33+
- "github.com/onsi/gomega"
2934
- name: error-return
3035
- name: error-strings
3136
- name: error-naming

docs/book/src/component-config-tutorial/testdata/project/test/e2e/e2e_suite_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ import (
2020
"fmt"
2121
"testing"
2222

23-
// nolint:revive
2423
. "github.com/onsi/ginkgo/v2"
25-
// nolint:revive
2624
. "github.com/onsi/gomega"
2725
)
2826

docs/book/src/component-config-tutorial/testdata/project/test/e2e/e2e_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ import (
2121
"os/exec"
2222
"time"
2323

24-
// nolint:revive
2524
. "github.com/onsi/ginkgo/v2"
26-
// nolint:revive
2725
. "github.com/onsi/gomega"
2826

2927
"tutorial.kubebuilder.io/project/test/utils"

docs/book/src/component-config-tutorial/testdata/project/test/utils/utils.go

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"os/exec"
2323
"strings"
2424

25-
// nolint:revive
2625
. "github.com/onsi/ginkgo/v2" //nolint:golint,revive
2726
)
2827

docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package v1
1818

1919
import (
20-
// nolint:revive
2120
. "github.com/onsi/ginkgo/v2"
2221
)
2322

docs/book/src/cronjob-tutorial/testdata/project/api/v1/webhook_suite_test.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ import (
2626
"testing"
2727
"time"
2828

29-
// nolint:revive
3029
. "github.com/onsi/ginkgo/v2"
31-
// nolint:revive
3230
. "github.com/onsi/gomega"
33-
admissionv1 "k8s.io/api/admission/v1"
3431

32+
admissionv1 "k8s.io/api/admission/v1"
3533
//+kubebuilder:scaffold:imports
3634
apimachineryruntime "k8s.io/apimachinery/pkg/runtime"
3735
"k8s.io/client-go/rest"

docs/book/src/cronjob-tutorial/testdata/project/internal/controller/cronjob_controller_test.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ import (
2929
"reflect"
3030
"time"
3131

32-
// nolint:revive
33-
. "github.com/onsi/ginkgo/v2"
34-
// nolint:revive
35-
. "github.com/onsi/gomega"
32+
. "github.com/onsi/ginkgo/v2"
33+
. "github.com/onsi/gomega"
3634
batchv1 "k8s.io/api/batch/v1"
3735
v1 "k8s.io/api/core/v1"
3836
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

docs/book/src/cronjob-tutorial/testdata/project/internal/controller/suite_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ import (
3434

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

37-
// nolint:revive
3837
. "github.com/onsi/ginkgo/v2"
39-
// nolint:revive
4038
. "github.com/onsi/gomega"
4139

4240
"k8s.io/client-go/kubernetes/scheme"

docs/book/src/cronjob-tutorial/testdata/project/test/e2e/e2e_suite_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ import (
2020
"fmt"
2121
"testing"
2222

23-
// nolint:revive
2423
. "github.com/onsi/ginkgo/v2"
25-
// nolint:revive
2624
. "github.com/onsi/gomega"
2725
)
2826

docs/book/src/cronjob-tutorial/testdata/project/test/e2e/e2e_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ import (
2121
"os/exec"
2222
"time"
2323

24-
// nolint:revive
2524
. "github.com/onsi/ginkgo/v2"
26-
// nolint:revive
2725
. "github.com/onsi/gomega"
2826

2927
"tutorial.kubebuilder.io/project/test/utils"

docs/book/src/cronjob-tutorial/testdata/project/test/utils/utils.go

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"os/exec"
2323
"strings"
2424

25-
// nolint:revive
2625
. "github.com/onsi/ginkgo/v2" //nolint:golint,revive
2726
)
2827

docs/book/src/getting-started/testdata/project/internal/controller/memcached_controller_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ import (
2323
"time"
2424

2525
//nolint:golint
26-
// nolint:revive
2726
. "github.com/onsi/ginkgo/v2"
28-
// nolint:revive
2927
. "github.com/onsi/gomega"
3028
appsv1 "k8s.io/api/apps/v1"
3129
corev1 "k8s.io/api/core/v1"

docs/book/src/getting-started/testdata/project/internal/controller/suite_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ import (
2222
"runtime"
2323
"testing"
2424

25-
// nolint:revive
2625
. "github.com/onsi/ginkgo/v2"
27-
// nolint:revive
2826
. "github.com/onsi/gomega"
2927

3028
"k8s.io/client-go/kubernetes/scheme"

docs/book/src/getting-started/testdata/project/test/e2e/e2e_suite_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ import (
2020
"fmt"
2121
"testing"
2222

23-
// nolint:revive
2423
. "github.com/onsi/ginkgo/v2"
25-
// nolint:revive
2624
. "github.com/onsi/gomega"
2725
)
2826

docs/book/src/getting-started/testdata/project/test/e2e/e2e_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ import (
2121
"os/exec"
2222
"time"
2323

24-
// nolint:revive
2524
. "github.com/onsi/ginkgo/v2"
26-
// nolint:revive
2725
. "github.com/onsi/gomega"
2826

2927
"example.com/memcached/test/utils"

docs/book/src/getting-started/testdata/project/test/utils/utils.go

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"os/exec"
2323
"strings"
2424

25-
// nolint:revive
2625
. "github.com/onsi/ginkgo/v2" //nolint:golint,revive
2726
)
2827

docs/book/src/multiversion-tutorial/testdata/project/api/v1/cronjob_webhook_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package v1
1818

1919
import (
20-
// nolint:revive
2120
. "github.com/onsi/ginkgo/v2"
2221
)
2322

docs/book/src/multiversion-tutorial/testdata/project/api/v1/webhook_suite_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ import (
2626
"testing"
2727
"time"
2828

29-
// nolint:revive
3029
. "github.com/onsi/ginkgo/v2"
31-
// nolint:revive
3230
. "github.com/onsi/gomega"
3331

3432
admissionv1 "k8s.io/api/admission/v1"

docs/book/src/multiversion-tutorial/testdata/project/api/v2/webhook_suite_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ import (
2626
"testing"
2727
"time"
2828

29-
// nolint:revive
3029
. "github.com/onsi/ginkgo/v2"
31-
// nolint:revive
3230
. "github.com/onsi/gomega"
3331

3432
admissionv1 "k8s.io/api/admission/v1"

docs/book/src/multiversion-tutorial/testdata/project/internal/controller/suite_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ import (
2525

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

28-
// nolint:revive
2928
. "github.com/onsi/ginkgo/v2"
30-
// nolint:revive
3129
. "github.com/onsi/gomega"
3230

3331
"k8s.io/client-go/kubernetes/scheme"

docs/book/src/multiversion-tutorial/testdata/project/test/e2e/e2e_suite_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ import (
2020
"fmt"
2121
"testing"
2222

23-
// nolint:revive
2423
. "github.com/onsi/ginkgo/v2"
25-
// nolint:revive
2624
. "github.com/onsi/gomega"
2725
)
2826

docs/book/src/multiversion-tutorial/testdata/project/test/e2e/e2e_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ import (
2121
"os/exec"
2222
"time"
2323

24-
// nolint:revive
2524
. "github.com/onsi/ginkgo/v2"
26-
// nolint:revive
2725
. "github.com/onsi/gomega"
2826

2927
"tutorial.kubebuilder.io/project/test/utils"

docs/book/src/multiversion-tutorial/testdata/project/test/utils/utils.go

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"os/exec"
2323
"strings"
2424

25-
// nolint:revive
2625
. "github.com/onsi/ginkgo/v2" //nolint:golint,revive
2726
)
2827

hack/docs/internal/cronjob-tutorial/writing_tests_controller.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ import (
4747
"reflect"
4848
"time"
4949
50-
// nolint:revive
51-
. "github.com/onsi/ginkgo/v2"
52-
// nolint:revive
53-
. "github.com/onsi/gomega"
50+
. "github.com/onsi/ginkgo/v2"
51+
. "github.com/onsi/gomega"
5452
batchv1 "k8s.io/api/batch/v1"
5553
v1 "k8s.io/api/core/v1"
5654
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

pkg/cli/cli_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ import (
2222
"os"
2323
"strings"
2424

25-
// nolint:revive
2625
. "github.com/onsi/ginkgo/v2"
27-
// nolint:revive
2826
. "github.com/onsi/gomega"
2927
"github.com/spf13/afero"
3028
"github.com/spf13/cobra"

pkg/cli/completion_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ limitations under the License.
1717
package cli
1818

1919
import (
20-
// nolint:revive
2120
. "github.com/onsi/ginkgo/v2"
22-
// nolint:revive
2321
. "github.com/onsi/gomega"
2422
)
2523

pkg/cli/options_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ import (
2323
"path/filepath"
2424
"runtime"
2525

26-
// nolint:revive
2726
. "github.com/onsi/ginkgo/v2"
28-
// nolint:revive
2927
. "github.com/onsi/gomega"
3028
"github.com/spf13/afero"
3129
"github.com/spf13/cobra"

pkg/cli/resource_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ limitations under the License.
1717
package cli
1818

1919
import (
20-
// nolint:revive
2120
. "github.com/onsi/ginkgo/v2"
22-
// nolint:revive
2321
. "github.com/onsi/gomega"
2422

2523
"sigs.k8s.io/kubebuilder/v3/pkg/model/resource"

pkg/cli/suite_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ package cli
1919
import (
2020
"testing"
2121

22-
// nolint:revive
2322
. "github.com/onsi/ginkgo/v2"
24-
// nolint:revive
2523
. "github.com/onsi/gomega"
2624

2725
"sigs.k8s.io/kubebuilder/v3/pkg/config"

pkg/cli/version_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ limitations under the License.
1717
package cli
1818

1919
import (
20-
// nolint:revive
2120
. "github.com/onsi/ginkgo/v2"
22-
// nolint:revive
2321
. "github.com/onsi/gomega"
2422
)
2523

pkg/config/errors_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ package config
1919
import (
2020
"fmt"
2121

22-
// nolint:revive
2322
. "github.com/onsi/ginkgo/v2"
24-
// nolint:revive
2523
. "github.com/onsi/gomega"
2624

2725
"sigs.k8s.io/kubebuilder/v3/pkg/model/resource"

pkg/config/registry_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ limitations under the License.
1717
package config
1818

1919
import (
20-
// nolint:revive
2120
. "github.com/onsi/ginkgo/v2"
22-
// nolint:revive
2321
. "github.com/onsi/gomega"
2422
)
2523

pkg/config/store/errors_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ import (
2020
"fmt"
2121
"testing"
2222

23-
// nolint:revive
2423
. "github.com/onsi/ginkgo/v2"
25-
// nolint:revive
2624
. "github.com/onsi/gomega"
2725
)
2826

pkg/config/store/yaml/store_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ import (
2121
"os"
2222
"testing"
2323

24-
// nolint:revive
2524
. "github.com/onsi/ginkgo/v2"
26-
// nolint:revive
2725
. "github.com/onsi/gomega"
2826
"github.com/spf13/afero"
2927

pkg/config/suite_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ package config
1919
import (
2020
"testing"
2121

22-
// nolint:revive
2322
. "github.com/onsi/ginkgo/v2"
24-
// nolint:revive
2523
. "github.com/onsi/gomega"
2624
)
2725

pkg/config/v2/config_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ package v2
2020
import (
2121
"testing"
2222

23-
// nolint:revive
2423
. "github.com/onsi/ginkgo/v2"
25-
// nolint:revive
2624
. "github.com/onsi/gomega"
2725

2826
"sigs.k8s.io/kubebuilder/v3/pkg/model/resource"

pkg/config/v3/config_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ import (
2121
"sort"
2222
"testing"
2323

24-
// nolint:revive
2524
. "github.com/onsi/ginkgo/v2"
26-
// nolint:revive
2725
. "github.com/onsi/gomega"
2826

2927
"sigs.k8s.io/kubebuilder/v3/pkg/config"

pkg/config/version_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ package config
1919
import (
2020
"sort"
2121

22-
// nolint:revive
2322
. "github.com/onsi/ginkgo/v2"
24-
// nolint:revive
2523
. "github.com/onsi/gomega"
2624

2725
"sigs.k8s.io/kubebuilder/v3/pkg/model/stage"

pkg/internal/validation/dns_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ import (
2121
"strings"
2222
"testing"
2323

24-
// nolint:revive
2524
. "github.com/onsi/ginkgo/v2"
26-
// nolint:revive
2725
. "github.com/onsi/gomega"
2826
)
2927

pkg/machinery/errors_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ import (
2020
"errors"
2121
"path/filepath"
2222

23-
// nolint:revive
2423
. "github.com/onsi/ginkgo/v2"
25-
// nolint:revive
2624
. "github.com/onsi/gomega"
2725
)
2826

0 commit comments

Comments
 (0)