From ac93282dfb4f35d697e5e9fc5eaa25d34dbbc354 Mon Sep 17 00:00:00 2001 From: Plamen Kokanov Date: Fri, 13 Dec 2024 14:49:51 +0200 Subject: [PATCH] Fix golangci-lint findings ``` redefines-builtin-id: redefinition of the built-in function new ``` --- pkg/admission/validator/shoot.go | 6 +++--- pkg/webhook/operatingsystemconfig/ensurer.go | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/admission/validator/shoot.go b/pkg/admission/validator/shoot.go index b042c0b3..542d0575 100644 --- a/pkg/admission/validator/shoot.go +++ b/pkg/admission/validator/shoot.go @@ -38,10 +38,10 @@ func NewShootValidator(apiReader client.Reader, decoder runtime.Decoder) extensi } // Validate validates the given shoot object. -func (s *shoot) Validate(ctx context.Context, new, _ client.Object) error { - shoot, ok := new.(*core.Shoot) +func (s *shoot) Validate(ctx context.Context, newObj, _ client.Object) error { + shoot, ok := newObj.(*core.Shoot) if !ok { - return fmt.Errorf("wrong object type %T", new) + return fmt.Errorf("wrong object type %T", newObj) } var ext *core.Extension diff --git a/pkg/webhook/operatingsystemconfig/ensurer.go b/pkg/webhook/operatingsystemconfig/ensurer.go index f8ff3bc8..96b2a7c5 100644 --- a/pkg/webhook/operatingsystemconfig/ensurer.go +++ b/pkg/webhook/operatingsystemconfig/ensurer.go @@ -38,7 +38,7 @@ type ensurer struct { } // EnsureAdditionalFiles ensures that the rsyslog configuration files are added to the files. -func (e *ensurer) EnsureAdditionalFiles(ctx context.Context, gctx gcontext.GardenContext, new, _ *[]extensionsv1alpha1.File) error { +func (e *ensurer) EnsureAdditionalFiles(ctx context.Context, gctx gcontext.GardenContext, newFiles, _ *[]extensionsv1alpha1.File) error { cluster, err := gctx.GetCluster(ctx) if err != nil { return err @@ -75,7 +75,7 @@ func (e *ensurer) EnsureAdditionalFiles(ctx context.Context, gctx gcontext.Garde return fmt.Errorf("failed to get rsyslog files: %w", err) } for _, file := range rsyslogFiles { - *new = extensionswebhook.EnsureFileWithPath(*new, file) + *newFiles = extensionswebhook.EnsureFileWithPath(*newFiles, file) } if shootRsyslogRelpConfig.AuditConfig == nil || shootRsyslogRelpConfig.AuditConfig.Enabled { @@ -84,14 +84,14 @@ func (e *ensurer) EnsureAdditionalFiles(ctx context.Context, gctx gcontext.Garde return fmt.Errorf("failed to get audit files: %w", err) } for _, file := range auditFiles { - *new = extensionswebhook.EnsureFileWithPath(*new, file) + *newFiles = extensionswebhook.EnsureFileWithPath(*newFiles, file) } } return nil } -func (e *ensurer) EnsureAdditionalUnits(_ context.Context, _ gcontext.GardenContext, new, _ *[]extensionsv1alpha1.Unit) error { - *new = extensionswebhook.EnsureUnitWithName(*new, getRsyslogConfiguratorUnit()) +func (e *ensurer) EnsureAdditionalUnits(_ context.Context, _ gcontext.GardenContext, newUnits, _ *[]extensionsv1alpha1.Unit) error { + *newUnits = extensionswebhook.EnsureUnitWithName(*newUnits, getRsyslogConfiguratorUnit()) return nil }