Skip to content

Commit 6fe2ffd

Browse files
committed
chore: address the comments
Signed-off-by: STRRL <[email protected]>
1 parent 844f97a commit 6fe2ffd

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

pkg/webhook/admission/admissiontest/util.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ func (v *FakeValidator) ValidateDelete() (warnings []string, err error) {
4747
return v.WarningsToReturn, v.ErrorToReturn
4848
}
4949

50-
func (v *FakeValidator) SetGroupVersionKind(kind schema.GroupVersionKind) {
51-
v.GVKToReturn = kind
50+
func (v *FakeValidator) SetGroupVersionKind(gvk schema.GroupVersionKind) {
51+
v.GVKToReturn = gvk
5252
}
5353

5454
func (v *FakeValidator) GroupVersionKind() schema.GroupVersionKind {
@@ -60,7 +60,8 @@ func (v *FakeValidator) GetObjectKind() schema.ObjectKind {
6060
}
6161

6262
func (v *FakeValidator) DeepCopyObject() runtime.Object {
63-
return &FakeValidator{ErrorToReturn: v.ErrorToReturn,
63+
return &FakeValidator{
64+
ErrorToReturn: v.ErrorToReturn,
6465
GVKToReturn: v.GVKToReturn,
6566
WarningsToReturn: v.WarningsToReturn,
6667
}

pkg/webhook/admission/validator.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ func (h *validatingHandler) Handle(ctx context.Context, req Request) Response {
8080
// No validation for connect requests.
8181
// TODO(vincepri): Should we validate CONNECT requests? In what cases?
8282
case v1.Create:
83-
err = h.decoder.Decode(req, obj)
84-
if err != nil {
83+
if err = h.decoder.Decode(req, obj); err != nil {
8584
return Errored(http.StatusBadRequest, err)
8685
}
8786

@@ -109,7 +108,7 @@ func (h *validatingHandler) Handle(ctx context.Context, req Request) Response {
109108

110109
warnings, err = obj.ValidateDelete()
111110
default:
112-
return Errored(http.StatusBadRequest, fmt.Errorf("unknown operation request %q", req.Operation))
111+
return Errored(http.StatusBadRequest, fmt.Errorf("unknown operation %q", req.Operation))
113112
}
114113

115114
if err != nil {

pkg/webhook/admission/validator_custom.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func (h *validatorForType) Handle(ctx context.Context, req Request) Response {
109109

110110
warnings, err = h.validator.ValidateDelete(ctx, obj)
111111
default:
112-
return Errored(http.StatusBadRequest, fmt.Errorf("unknown operation request %q", req.Operation))
112+
return Errored(http.StatusBadRequest, fmt.Errorf("unknown operation %q", req.Operation))
113113
}
114114

115115
// Check the error message first.

0 commit comments

Comments
 (0)