Skip to content

Commit

Permalink
chore: update golint (#3177)
Browse files Browse the repository at this point in the history
* chore: update golint

Signed-off-by: zirain <zirain2009@gmail.com>

* fix lint

Signed-off-by: zirain <zirain2009@gmail.com>

---------

Signed-off-by: zirain <zirain2009@gmail.com>
  • Loading branch information
zirain authored Apr 12, 2024
1 parent cdab7d5 commit 92b4a9b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
10 changes: 4 additions & 6 deletions test/cel-validation/backendtrafficpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import (
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

gwapiv1 "sigs.k8s.io/gateway-api/apis/v1"
gwapiv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"

Expand Down Expand Up @@ -436,8 +434,8 @@ func TestBackendTrafficPolicyTarget(t *testing.T) {
{
desc: " valid config: min, max, nil",
mutate: func(btp *egv1a1.BackendTrafficPolicy) {
valMax := pointer.Int64(4294967295)
valMin := pointer.Int64(0)
valMax := ptr.To[int64](4294967295)
valMin := ptr.To[int64](0)
btp.Spec = egv1a1.BackendTrafficPolicySpec{
TargetRef: gwapiv1a2.PolicyTargetReferenceWithSectionName{
PolicyTargetReference: gwapiv1a2.PolicyTargetReference{
Expand All @@ -459,8 +457,8 @@ func TestBackendTrafficPolicyTarget(t *testing.T) {
{
desc: " invalid config: min and max values",
mutate: func(btp *egv1a1.BackendTrafficPolicy) {
valOverMax := pointer.Int64(4294967296)
valUnderMin := pointer.Int64(-1)
valOverMax := ptr.To[int64](4294967296)
valUnderMin := ptr.To[int64](-1)
btp.Spec = egv1a1.BackendTrafficPolicySpec{
TargetRef: gwapiv1a2.PolicyTargetReferenceWithSectionName{
PolicyTargetReference: gwapiv1a2.PolicyTargetReference{
Expand Down
7 changes: 5 additions & 2 deletions test/cel-validation/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import (
var c client.Client

func TestMain(m *testing.M) {
os.Exit(runTest(m))
}

func runTest(m *testing.M) int {
// Setup the test environment.
testEnv, restCfg, err := startEnv()
if err != nil {
Expand All @@ -47,8 +51,7 @@ func TestMain(m *testing.M) {
panic(fmt.Sprintf("Error initializing client: %v", err))
}
_ = egv1a1.AddToScheme(c.Scheme())

os.Exit(m.Run())
return m.Run()
}

func startEnv() (*envtest.Environment, *rest.Config, error) {
Expand Down
2 changes: 1 addition & 1 deletion tools/make/lint.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ lint: lint.golint
lint-deps: $(tools/golangci-lint)
lint.golint: $(tools/golangci-lint)
@$(LOG_TARGET)
$(tools/golangci-lint) run $(GOLANGCI_LINT_FLAGS) --build-tags=e2e --config=tools/linter/golangci-lint/.golangci.yml
$(tools/golangci-lint) run $(GOLANGCI_LINT_FLAGS) --build-tags=e2e,celvalidation --config=tools/linter/golangci-lint/.golangci.yml

.PHONY: lint.yamllint
lint: lint.yamllint
Expand Down

0 comments on commit 92b4a9b

Please sign in to comment.