Skip to content

Commit f4208ed

Browse files
committed
Fix webhook interface method validateUpdate args
1 parent f8ff0ab commit f4208ed

File tree

5 files changed

+58
-13
lines changed

5 files changed

+58
-13
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ jobs:
1111
name: lint
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
15-
- uses: actions/setup-go@v3
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-go@v5
1616
with:
17-
go-version: '1.22'
17+
go-version: '1.23'
1818
check-latest: true
1919
cache: true
2020
- name: golangci-lint
21-
uses: golangci/golangci-lint-action@v3
21+
uses: golangci/golangci-lint-action@v8
2222
with:
23-
version: v1.55.2
24-
# Disable package caching to avoid a double cache with setup-go.
25-
skip-pkg-cache: true
23+
version: v2.1.0
24+
only-new-issues: true
2625
args: --timeout 10m
26+

.github/workflows/vulnerability.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
show-progress: false
2323
- name: "Dependency Review"
24-
uses: actions/dependency-review-action@v3
24+
uses: actions/dependency-review-action@v4
2525
with:
2626
base-ref: ${{ github.event.pull_request.base.sha || github.event.before || github.sha }}
2727
head-ref: ${{ github.event.pull_request.head.sha || github.sha }}

.golangci.yml

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,49 @@
1+
version: "2"
12
run:
23
timeout: 10m
3-
skip-dirs:
4-
- "api/v1alpha3"
4+
linters:
5+
enable:
6+
- gocyclo
7+
- godot
8+
- nakedret
9+
- revive
10+
settings:
11+
gocyclo:
12+
min-complexity: 10
13+
godot:
14+
exclude:
15+
- (?i)^\s*todo
16+
period: true
17+
exclusions:
18+
generated: lax
19+
presets:
20+
- common-false-positives
21+
- std-error-handling
22+
paths:
23+
- zz_generated.*\.go$
24+
- .*/mocks
25+
- internal/aws-sdk-go-v2
26+
- builtin$
27+
- examples$
28+
issues:
29+
max-issues-per-linter: 0
30+
max-same-issues: 0
31+
formatters:
32+
enable:
33+
- gci
34+
- gofumpt
35+
settings:
36+
gci:
37+
sections:
38+
- standard
39+
- default
40+
- prefix(github.com/aws/etcdadm-controller)
41+
custom-order: true
42+
exclusions:
43+
generated: lax
44+
paths:
45+
- zz_generated.*\.go$
46+
- .*/mocks
47+
- internal/aws-sdk-go-v2
48+
- builtin$
49+
- examples$

api/v1beta1/etcdadmcluster_webhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (r *EtcdadmCluster) ValidateCreate(_ context.Context, obj runtime.Object) (
8686
}
8787

8888
// ValidateUpdate implements webhook.CustomValidator so a webhook will be registered for the type
89-
func (r *EtcdadmCluster) ValidateUpdate(_ context.Context, obj, old runtime.Object) (admission.Warnings, error) {
89+
func (r *EtcdadmCluster) ValidateUpdate(_ context.Context, old, obj runtime.Object) (admission.Warnings, error) {
9090
etcdadmCluster, ok := obj.(*EtcdadmCluster)
9191
if !ok {
9292
return nil, fmt.Errorf("expected an EtcdadmCluster but got %T", obj)
@@ -153,4 +153,4 @@ func (r *EtcdadmCluster) validateCommon() (allErrs field.ErrorList) {
153153
}
154154

155155
return allErrs
156-
}
156+
}

api/v1beta1/etcdadmcluster_webhook_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func TestEtcdadmClusterValidateUpdateCastFail(t *testing.T) {
6969
config := &EtcdadmCluster{}
7070

7171
// Call ValidateUpdate with the wrong type
72-
warnings, err := config.ValidateUpdate(context.TODO(), wrongType, &EtcdadmCluster{})
72+
warnings, err := config.ValidateUpdate(context.TODO(), &EtcdadmCluster{}, wrongType)
7373

7474
// Verify that an error is returned
7575
g.Expect(warnings).To(BeNil())

0 commit comments

Comments
 (0)