Skip to content

Commit 600f749

Browse files
author
Kevin Conner
committed
chore: cleanup
Signed-off-by: Kevin Conner <kev.conner@getupcloud.com>
1 parent f2eb4d7 commit 600f749

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

k8s/authorizer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (r *ResourceCheck) Receive(function string, overload string, args []ref.Val
186186
return types.NewErr("namespace already invoked")
187187
}
188188
if namespace, ok := getString(args[0].Value()); ok {
189-
resourceCheck := &*r
189+
resourceCheck := r
190190
initResourceReceiver(resourceCheck, &namespace, resourceCheck.name, r.noSubresource)
191191
return resourceCheck
192192
}
@@ -198,7 +198,7 @@ func (r *ResourceCheck) Receive(function string, overload string, args []ref.Val
198198
if len(name) == 0 {
199199
return r
200200
}
201-
resourceCheck := &*r
201+
resourceCheck := r
202202
initResourceReceiver(resourceCheck, resourceCheck.namespace, &name, r.noSubresource)
203203
return resourceCheck
204204
}

k8s/conversion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func convertToMap(val any) (map[string]any, error) {
2323
return nil, err
2424
}
2525
result := map[string]any{}
26-
yaml.Unmarshal(bytes, result)
26+
err = yaml.Unmarshal(bytes, result)
2727
if err != nil {
2828
return nil, err
2929
}

k8s/evals.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ type EvalResponse struct {
121121
Validations []*EvalResult `json:"validations,omitempty"`
122122
AuditAnnotations []*EvalResult `json:"auditAnnotations,omitempty"`
123123
WebhookMatchConditions [][]*EvalResult `json:"webhookMatchConditions,omitempty"`
124-
Cost *uint64 `json:"cost, omitempty"`
124+
Cost *uint64 `json:"cost,omitempty"`
125125
}
126126

127127
func getResults(val *ref.Val) (any, *string) {

k8s/validatingadmissionpolicy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func EvalValidatingAdmissionPolicy(policyInput, oldObjectInput, objectValueInput
165165
// 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.
166166
// 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the request resource.
167167

168-
matchConditionsEnvOptions := append([]cel.EnvOption(nil), celEnvOptions...)
168+
matchConditionsEnvOptions := append([]cel.EnvOption{}, celEnvOptions...)
169169
matchConditionsEnvOptions = append(matchConditionsEnvOptions, matchConditionsCelVars...)
170170
matchConditionsEnv, err := cel.NewEnv(matchConditionsEnvOptions...)
171171
if err != nil {
@@ -214,7 +214,7 @@ func EvalValidatingAdmissionPolicy(policyInput, oldObjectInput, objectValueInput
214214

215215
// run validations only if matchConditions pass
216216
if matchConditions {
217-
validationEnvOptions := append([]cel.EnvOption(nil), celEnvOptions...)
217+
validationEnvOptions := append([]cel.EnvOption{}, celEnvOptions...)
218218
validationEnvOptions = append(validationEnvOptions, validationCelVars...)
219219
validationEnv, err := cel.NewEnv(validationEnvOptions...)
220220
if err != nil {

k8s/webhook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func EvalWebhook(webhookInput, oldObjectInput, objectValueInput, requestInput, a
8484
// 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.
8585
// 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the request resource.
8686

87-
matchConditionsEnvOptions := append([]cel.EnvOption(nil), celEnvOptions...)
87+
matchConditionsEnvOptions := append([]cel.EnvOption{}, celEnvOptions...)
8888
matchConditionsEnvOptions = append(matchConditionsEnvOptions, matchConditionsCelVars...)
8989
matchConditionsEnv, err := cel.NewEnv(matchConditionsEnvOptions...)
9090
if err != nil {

0 commit comments

Comments
 (0)