From 65594a121dad227c0e1064dafb328992bb0442f6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2024 10:31:48 +0200 Subject: [PATCH] build(deps): bump golang from 1.22.5 to 1.23.0 (#1140) * build(deps): bump golang from 1.22.5 to 1.23.0 Bumps golang from 1.22.5 to 1.23.0. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update golangci-lint * Remove depguard linter as we do not have that configured * Remove deprecated megacheck linter * Fix linting issues * Fix more linting issues * More linting fixes * Fix more linting issues * Update testcase for error message check --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Horst Gutmann --- .golangci.yml | 4 +--- Dockerfile | 10 +++++----- Makefile | 2 +- cmd/tk/env.go | 4 ++-- cmd/tk/export.go | 2 +- cmd/tk/fmt.go | 4 ++-- cmd/tk/init.go | 2 +- cmd/tk/jsonnet.go | 2 +- cmd/tk/lint.go | 2 +- cmd/tk/prefix.go | 2 +- cmd/tk/status.go | 2 +- cmd/tk/tool.go | 6 +++--- cmd/tk/toolCharts.go | 12 ++++++------ cmd/tk/workflow.go | 10 +++++----- pkg/helm/charts_test.go | 4 ++-- pkg/helm/spec.go | 2 +- 16 files changed, 34 insertions(+), 36 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 44c01b19c..6b5c02a00 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,9 +1,8 @@ linters: enable: - - depguard - dogsled - errcheck - - exportloopref + - copyloopvar - goconst - gocritic - gofmt @@ -11,7 +10,6 @@ linters: - gosimple - govet - ineffassign - - megacheck - misspell - revive - staticcheck diff --git a/Dockerfile b/Dockerfile index 10cc38999..de5023986 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # download kubectl -FROM golang:1.22.5-alpine AS kubectl +FROM golang:1.23.0-alpine AS kubectl RUN apk add --no-cache curl RUN export VERSION=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt) &&\ export OS=$(go env GOOS) && \ @@ -8,7 +8,7 @@ RUN export VERSION=$(curl -s https://storage.googleapis.com/kubernetes-release/r chmod +x /usr/local/bin/kubectl # build jsonnet-bundler -FROM golang:1.22.5-alpine AS jb +FROM golang:1.23.0-alpine AS jb WORKDIR /tmp RUN apk add --no-cache git make bash &&\ git clone https://github.com/jsonnet-bundler/jsonnet-bundler &&\ @@ -17,7 +17,7 @@ RUN apk add --no-cache git make bash &&\ make static &&\ mv _output/jb /usr/local/bin/jb -FROM golang:1.22.5-alpine AS helm +FROM golang:1.23.0-alpine AS helm WORKDIR /tmp/helm RUN apk add --no-cache jq curl RUN export TAG=$(curl --silent "https://api.github.com/repos/helm/helm/releases/latest" | jq -r .tag_name) &&\ @@ -26,7 +26,7 @@ RUN export TAG=$(curl --silent "https://api.github.com/repos/helm/helm/releases/ curl -SL "https://get.helm.sh/helm-${TAG}-${OS}-${ARCH}.tar.gz" > helm.tgz && \ tar -xvf helm.tgz --strip-components=1 -FROM golang:1.22.5-alpine AS kustomize +FROM golang:1.23.0-alpine AS kustomize WORKDIR /tmp/kustomize RUN apk add --no-cache jq curl # Get the latest version of kustomize @@ -39,7 +39,7 @@ RUN export TAG=$(curl --silent "https://api.github.com/repos/kubernetes-sigs/kus curl -SL "https://github.com/kubernetes-sigs/kustomize/releases/download/${TAG}/kustomize_${VERSION_TAG}_${OS}_${ARCH}.tar.gz" > kustomize.tgz && \ tar -xvf kustomize.tgz -FROM golang:1.22.5 AS build +FROM golang:1.23.0 AS build WORKDIR /app COPY . . RUN make static diff --git a/Makefile b/Makefile index a04fd8d61..86c2598bd 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ GOX := $(BIN_DIR)/gox GOLINTER := $(GOPATH)/bin/golangci-lint $(GOLINTER): - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3 lint: $(GOLINTER) $(GOLINTER) run diff --git a/cmd/tk/env.go b/cmd/tk/env.go index 3ad5270c5..7659cb541 100644 --- a/cmd/tk/env.go +++ b/cmd/tk/env.go @@ -206,7 +206,7 @@ func envRemoveCmd() *cli.Command { Aliases: []string{"rm"}, Short: "delete an environment", Args: workflowArgs, - Run: func(cmd *cli.Command, args []string) error { + Run: func(_ *cli.Command, args []string) error { for _, arg := range args { path, err := filepath.Abs(arg) if err != nil { @@ -243,7 +243,7 @@ func envListCmd() *cli.Command { getJsonnetOpts := jsonnetFlags(cmd.Flags()) - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { var path string var err error if len(args) == 1 { diff --git a/cmd/tk/export.go b/cmd/tk/export.go index fc6896ce0..4d54bb813 100644 --- a/cmd/tk/export.go +++ b/cmd/tk/export.go @@ -48,7 +48,7 @@ func exportCmd() *cli.Command { recursive := cmd.Flags().BoolP("recursive", "r", false, "Look recursively for Tanka environments") - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { // Allocate a block of memory to alter GC behaviour. See https://github.com/golang/go/issues/23044 ballast := make([]byte, *ballastBytes) defer runtime.KeepAlive(ballast) diff --git a/cmd/tk/fmt.go b/cmd/tk/fmt.go index c32fd02d7..f73b67c06 100644 --- a/cmd/tk/fmt.go +++ b/cmd/tk/fmt.go @@ -30,7 +30,7 @@ func fmtCmd() *cli.Command { exclude := cmd.Flags().StringSliceP("exclude", "e", []string{"**/.*", ".*", "**/vendor/**", "vendor/**"}, "globs to exclude") verbose := cmd.Flags().BoolP("verbose", "v", false, "print each checked file") - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { if len(args) == 1 && args[0] == ArgStdin { return fmtStdin(*test) } @@ -47,7 +47,7 @@ func fmtCmd() *cli.Command { var outFn tanka.OutFn switch { case *test: - outFn = func(name, content string) error { return nil } + outFn = func(_, _ string) error { return nil } case *stdout: outFn = func(name, content string) error { fmt.Printf("// %s\n%s", name, content) diff --git a/cmd/tk/init.go b/cmd/tk/init.go index 170423066..8b49be2d1 100644 --- a/cmd/tk/init.go +++ b/cmd/tk/init.go @@ -26,7 +26,7 @@ func initCmd() *cli.Command { installK8s := cmd.Flags().String("k8s", defaultK8sVersion, "choose the version of k8s-libsonnet, set to false to skip") inline := cmd.Flags().BoolP("inline", "i", false, "create an inline environment") - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, _ []string) error { failed := false files, err := os.ReadDir(".") diff --git a/cmd/tk/jsonnet.go b/cmd/tk/jsonnet.go index 9205bae4c..bd1e40653 100644 --- a/cmd/tk/jsonnet.go +++ b/cmd/tk/jsonnet.go @@ -20,7 +20,7 @@ func evalCmd() *cli.Command { getJsonnetOpts := jsonnetFlags(cmd.Flags()) - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { jsonnetOpts := tanka.Opts{ JsonnetImplementation: *jsonnetImplementation, JsonnetOpts: getJsonnetOpts(), diff --git a/cmd/tk/lint.go b/cmd/tk/lint.go index 9bb6edf4c..bad3679ba 100644 --- a/cmd/tk/lint.go +++ b/cmd/tk/lint.go @@ -27,7 +27,7 @@ func lintCmd() *cli.Command { panic(err) } - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { globs := make([]glob.Glob, len(*exclude)) for i, e := range *exclude { g, err := glob.Compile(e) diff --git a/cmd/tk/prefix.go b/cmd/tk/prefix.go index 4a6ca28c8..ef20e65f9 100644 --- a/cmd/tk/prefix.go +++ b/cmd/tk/prefix.go @@ -31,7 +31,7 @@ func prefixCommands(prefix string) (cmds []*cli.Command) { extCommand.Stdout = os.Stdout extCommand.Stderr = os.Stderr - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { extCommand.Args = append(extCommand.Args, args...) return extCommand.Run() } diff --git a/cmd/tk/status.go b/cmd/tk/status.go index 85cc8147c..8d76c5676 100644 --- a/cmd/tk/status.go +++ b/cmd/tk/status.go @@ -23,7 +23,7 @@ func statusCmd() *cli.Command { vars := workflowFlags(cmd.Flags()) getJsonnetOpts := jsonnetFlags(cmd.Flags()) - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { status, err := tanka.Status(args[0], tanka.Opts{ JsonnetImplementation: vars.jsonnetImplementation, JsonnetOpts: getJsonnetOpts(), diff --git a/cmd/tk/tool.go b/cmd/tk/tool.go index 9ed56e65a..36a0f66dc 100644 --- a/cmd/tk/tool.go +++ b/cmd/tk/tool.go @@ -42,7 +42,7 @@ func jpathCmd() *cli.Command { debug := cmd.Flags().BoolP("debug", "d", false, "show debug info") - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { path := args[0] entrypoint, err := jpath.Entrypoint(path) @@ -81,7 +81,7 @@ func importsCmd() *cli.Command { check := cmd.Flags().StringP("check", "c", "", "git commit hash to check against") - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { var modFiles []string if *check != "" { var err error @@ -156,7 +156,7 @@ if the file is not a vendored (located at /vendor/) or a lib file (loca } root := cmd.Flags().String("root", ".", "root directory to search for environments") - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { root, err := filepath.Abs(*root) if err != nil { return fmt.Errorf("resolving root: %w", err) diff --git a/cmd/tk/toolCharts.go b/cmd/tk/toolCharts.go index cf032f1b8..57047fb23 100644 --- a/cmd/tk/toolCharts.go +++ b/cmd/tk/toolCharts.go @@ -41,7 +41,7 @@ func chartsVendorCmd() *cli.Command { prune := cmd.Flags().Bool("prune", false, "also remove non-vendored files from the destination directory") repoConfigPath := cmd.Flags().String("repository-config", "", repoConfigFlagUsage) - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, _ []string) error { c, err := loadChartfile() if err != nil { return err @@ -60,7 +60,7 @@ func chartsAddCmd() *cli.Command { } repoConfigPath := cmd.Flags().String("repository-config", "", repoConfigFlagUsage) - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { c, err := loadChartfile() if err != nil { return err @@ -79,7 +79,7 @@ func chartsAddRepoCmd() *cli.Command { Args: cli.ArgsExact(2), } - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { c, err := loadChartfile() if err != nil { return err @@ -100,7 +100,7 @@ func chartsConfigCmd() *cli.Command { Short: "Displays the current manifest", } - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, _ []string) error { c, err := loadChartfile() if err != nil { return err @@ -125,7 +125,7 @@ func chartsInitCmd() *cli.Command { Short: "Create a new Chartfile", } - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, _ []string) error { wd, err := os.Getwd() if err != nil { return err @@ -155,7 +155,7 @@ func chartsVersionCheckCmd() *cli.Command { repoConfigPath := cmd.Flags().String("repository-config", "", repoConfigFlagUsage) prettyPrint := cmd.Flags().Bool("pretty-print", false, "pretty print json output with indents") - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, _ []string) error { c, err := loadChartfile() if err != nil { return err diff --git a/cmd/tk/workflow.go b/cmd/tk/workflow.go index b555a24e7..fbfa94a73 100644 --- a/cmd/tk/workflow.go +++ b/cmd/tk/workflow.go @@ -95,7 +95,7 @@ func applyCmd() *cli.Command { vars := workflowFlags(cmd.Flags()) getJsonnetOpts := jsonnetFlags(cmd.Flags()) - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { err := validateDryRun(opts.DryRun) if err != nil { return err @@ -141,7 +141,7 @@ func pruneCmd() *cli.Command { addDiffFlags(cmd.Flags(), &opts.DiffBaseOpts) getJsonnetOpts := jsonnetFlags(cmd.Flags()) - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { err := validateDryRun(opts.DryRun) if err != nil { return err @@ -182,7 +182,7 @@ func deleteCmd() *cli.Command { vars := workflowFlags(cmd.Flags()) getJsonnetOpts := jsonnetFlags(cmd.Flags()) - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { err := validateDryRun(opts.DryRun) if err != nil { return err @@ -229,7 +229,7 @@ func diffCmd() *cli.Command { vars := workflowFlags(cmd.Flags()) getJsonnetOpts := jsonnetFlags(cmd.Flags()) - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { if err := setForceColor(&opts.DiffBaseOpts); err != nil { return err } @@ -280,7 +280,7 @@ func showCmd() *cli.Command { vars := workflowFlags(cmd.Flags()) getJsonnetOpts := jsonnetFlags(cmd.Flags()) - cmd.Run = func(cmd *cli.Command, args []string) error { + cmd.Run = func(_ *cli.Command, args []string) error { if !interactive && !*allowRedirect { fmt.Fprintln(os.Stderr, `Redirection of the output of tk show is discouraged and disabled by default. If you want to export .yaml files for use with other tools, try 'tk export'. diff --git a/pkg/helm/charts_test.go b/pkg/helm/charts_test.go index 89f81a3cd..9f7f89451 100644 --- a/pkg/helm/charts_test.go +++ b/pkg/helm/charts_test.go @@ -97,7 +97,7 @@ func TestAdd(t *testing.T) { // Adding a chart with a different version to the same path, causes a conflict err = c.Add([]string{"stable/prometheus@11.12.0"}, "") - assert.EqualError(t, err, `Validation errors: + assert.EqualError(t, err, `validation errors: - output directory "prometheus" is used twice, by charts "stable/prometheus@11.12.1" and "stable/prometheus@11.12.0"`) // Add a chart with a specific extract directory @@ -241,7 +241,7 @@ func TestInvalidChartName(t *testing.T) { }) err = c.Vendor(false, "") - assert.EqualError(t, err, `Validation errors: + assert.EqualError(t, err, `validation errors: - Chart name "noslash" is not valid. Expecting a repo/name format.`) } diff --git a/pkg/helm/spec.go b/pkg/helm/spec.go index c519ae86c..f7aaa3eae 100644 --- a/pkg/helm/spec.go +++ b/pkg/helm/spec.go @@ -132,7 +132,7 @@ func (r Requirements) Validate() error { } if len(errs) > 0 { - return fmt.Errorf("Validation errors:\n - " + strings.Join(errs, "\n - ")) + return fmt.Errorf("validation errors:\n - %s", strings.Join(errs, "\n - ")) } return nil