From 586a4b5cae47a32a1c98bd9aa77625f802c13173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Wed, 21 Aug 2024 16:23:10 +0200 Subject: [PATCH] chore: add support for mirror and makezero --- .golangci.yml | 2 ++ internal/namespaces/autocomplete/autocomplete.go | 2 +- internal/namespaces/config/commands_test.go | 2 +- internal/namespaces/registry/v1/helpers_docker.go | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index c1b495581a..9243deb9ed 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -31,6 +31,8 @@ linters: - ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false] - intrange # intrange is a linter to find places where for loops could make use of an integer range. [fast: true, auto-fix: false] - loggercheck # (logrlint): Checks key value pairs for common logger libraries (kitlog,klog,logr,zap). [fast: false, auto-fix: false] + - makezero # Finds slice declarations with non-zero initial length [fast: false, auto-fix: false] + - mirror # reports wrong mirror patterns of bytes/strings usage [fast: false, auto-fix: false] - misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true] - nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false] - nolintlint # Reports ill-formed or insufficient nolint directives [fast: true, auto-fix: false] diff --git a/internal/namespaces/autocomplete/autocomplete.go b/internal/namespaces/autocomplete/autocomplete.go index dddc7cddfb..1b8cfe1a12 100644 --- a/internal/namespaces/autocomplete/autocomplete.go +++ b/internal/namespaces/autocomplete/autocomplete.go @@ -243,7 +243,7 @@ func InstallCommandRun(ctx context.Context, argsI interface{}) (i interface{}, e } // Append to file - _, err = f.Write([]byte(autoCompleteScript + "\n")) + _, err = f.WriteString(autoCompleteScript + "\n") if err != nil { return nil, err } diff --git a/internal/namespaces/config/commands_test.go b/internal/namespaces/config/commands_test.go index dda21d9d3b..ab6c4e2571 100644 --- a/internal/namespaces/config/commands_test.go +++ b/internal/namespaces/config/commands_test.go @@ -495,7 +495,7 @@ profiles: send_telemetry: true ` - if _, err := tmpFile.Write([]byte(configContent)); err != nil { + if _, err := tmpFile.WriteString(configContent); err != nil { return nil, err } if err := tmpFile.Close(); err != nil { diff --git a/internal/namespaces/registry/v1/helpers_docker.go b/internal/namespaces/registry/v1/helpers_docker.go index e728312479..8e38bcdeb1 100644 --- a/internal/namespaces/registry/v1/helpers_docker.go +++ b/internal/namespaces/registry/v1/helpers_docker.go @@ -35,7 +35,7 @@ func writeHelperScript(scriptPath string, scriptContent string) error { } defer f.Close() - _, err = f.Write([]byte(scriptContent)) + _, err = f.WriteString(scriptContent) if err != nil { return err }