diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ad4c0290f6a..76d9e378ab7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,7 +24,7 @@ jobs: - name: Run linter uses: golangci/golangci-lint-action@v6 with: - version: v1.59 + version: v1.61 yamllint: runs-on: ubuntu-latest diff --git a/.golangci.yml b/.golangci.yml index 20a502ddcea..f768e89d686 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -68,7 +68,7 @@ linters: enable: - dupl - errcheck - - exportloopref + - copyloopvar - ginkgolinter - goconst - gocyclo diff --git a/Makefile b/Makefile index 6d90ad0d036..ff51b14e5ba 100644 --- a/Makefile +++ b/Makefile @@ -104,7 +104,7 @@ GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint golangci-lint: @[ -f $(GOLANGCI_LINT) ] || { \ set -e ;\ - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.59.1 ;\ + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.61.0 ;\ } .PHONY: apidiff diff --git a/docs/book/src/cronjob-tutorial/testdata/project/.github/workflows/lint.yml b/docs/book/src/cronjob-tutorial/testdata/project/.github/workflows/lint.yml index b6967b35f4f..f40d36579ce 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/.github/workflows/lint.yml +++ b/docs/book/src/cronjob-tutorial/testdata/project/.github/workflows/lint.yml @@ -20,4 +20,4 @@ jobs: - name: Run linter uses: golangci/golangci-lint-action@v6 with: - version: v1.59 + version: v1.61 diff --git a/docs/book/src/cronjob-tutorial/testdata/project/Makefile b/docs/book/src/cronjob-tutorial/testdata/project/Makefile index 4d6c3ada718..ba36d148420 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/Makefile +++ b/docs/book/src/cronjob-tutorial/testdata/project/Makefile @@ -177,7 +177,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint KUSTOMIZE_VERSION ?= v5.5.0 CONTROLLER_TOOLS_VERSION ?= v0.16.4 ENVTEST_VERSION ?= release-0.19 -GOLANGCI_LINT_VERSION ?= v1.59.1 +GOLANGCI_LINT_VERSION ?= v1.61.0 .PHONY: kustomize kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. diff --git a/docs/book/src/getting-started/testdata/project/.github/workflows/lint.yml b/docs/book/src/getting-started/testdata/project/.github/workflows/lint.yml index b6967b35f4f..f40d36579ce 100644 --- a/docs/book/src/getting-started/testdata/project/.github/workflows/lint.yml +++ b/docs/book/src/getting-started/testdata/project/.github/workflows/lint.yml @@ -20,4 +20,4 @@ jobs: - name: Run linter uses: golangci/golangci-lint-action@v6 with: - version: v1.59 + version: v1.61 diff --git a/docs/book/src/getting-started/testdata/project/Makefile b/docs/book/src/getting-started/testdata/project/Makefile index 31451d80693..30cbd42173c 100644 --- a/docs/book/src/getting-started/testdata/project/Makefile +++ b/docs/book/src/getting-started/testdata/project/Makefile @@ -173,7 +173,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint KUSTOMIZE_VERSION ?= v5.5.0 CONTROLLER_TOOLS_VERSION ?= v0.16.4 ENVTEST_VERSION ?= release-0.19 -GOLANGCI_LINT_VERSION ?= v1.59.1 +GOLANGCI_LINT_VERSION ?= v1.61.0 .PHONY: kustomize kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. diff --git a/docs/book/src/multiversion-tutorial/testdata/project/.github/workflows/lint.yml b/docs/book/src/multiversion-tutorial/testdata/project/.github/workflows/lint.yml index b6967b35f4f..f40d36579ce 100644 --- a/docs/book/src/multiversion-tutorial/testdata/project/.github/workflows/lint.yml +++ b/docs/book/src/multiversion-tutorial/testdata/project/.github/workflows/lint.yml @@ -20,4 +20,4 @@ jobs: - name: Run linter uses: golangci/golangci-lint-action@v6 with: - version: v1.59 + version: v1.61 diff --git a/docs/book/src/multiversion-tutorial/testdata/project/Makefile b/docs/book/src/multiversion-tutorial/testdata/project/Makefile index 4d6c3ada718..ba36d148420 100644 --- a/docs/book/src/multiversion-tutorial/testdata/project/Makefile +++ b/docs/book/src/multiversion-tutorial/testdata/project/Makefile @@ -177,7 +177,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint KUSTOMIZE_VERSION ?= v5.5.0 CONTROLLER_TOOLS_VERSION ?= v0.16.4 ENVTEST_VERSION ?= release-0.19 -GOLANGCI_LINT_VERSION ?= v1.59.1 +GOLANGCI_LINT_VERSION ?= v1.61.0 .PHONY: kustomize kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. diff --git a/pkg/cli/resource.go b/pkg/cli/resource.go index 87973f2cbdb..e258dd1a850 100644 --- a/pkg/cli/resource.go +++ b/pkg/cli/resource.go @@ -17,7 +17,7 @@ limitations under the License. package cli import ( - "fmt" + "errors" "strings" "github.com/spf13/pflag" @@ -53,13 +53,13 @@ func (opts resourceOptions) validate() error { // NOTE: We must do this for all the required flags first or we may output the wrong // error as flags may seem to be missing because Cobra assigned them to another flag. if strings.HasPrefix(opts.Group, "-") { - return fmt.Errorf(groupPresent) + return errors.New(groupPresent) } if strings.HasPrefix(opts.Version, "-") { - return fmt.Errorf(versionPresent) + return errors.New(versionPresent) } if strings.HasPrefix(opts.Kind, "-") { - return fmt.Errorf(kindPresent) + return errors.New(kindPresent) } // We do not check here if the GVK values are empty because that would diff --git a/pkg/model/resource/gvk.go b/pkg/model/resource/gvk.go index 266859be7a8..3b4253124e6 100644 --- a/pkg/model/resource/gvk.go +++ b/pkg/model/resource/gvk.go @@ -17,6 +17,7 @@ limitations under the License. package resource import ( + "errors" "fmt" "strings" @@ -44,7 +45,7 @@ type GVK struct { func (gvk GVK) Validate() error { // Check if the qualified group has a valid DNS1123 subdomain value if gvk.QualifiedGroup() == "" { - return fmt.Errorf(groupRequired) + return errors.New(groupRequired) } if err := validation.IsDNS1123Subdomain(gvk.QualifiedGroup()); err != nil { // NOTE: IsDNS1123Subdomain returns a slice of strings instead of an error, so no wrapping @@ -53,7 +54,7 @@ func (gvk GVK) Validate() error { // Check if the version follows the valid pattern if gvk.Version == "" { - return fmt.Errorf(versionRequired) + return errors.New(versionRequired) } errs := validation.IsDNS1123Subdomain(gvk.Version) if len(errs) > 0 && gvk.Version != versionInternal { @@ -62,7 +63,7 @@ func (gvk GVK) Validate() error { // Check if kind has a valid DNS1035 label value if gvk.Kind == "" { - return fmt.Errorf(kindRequired) + return errors.New(kindRequired) } if errors := validation.IsDNS1035Label(strings.ToLower(gvk.Kind)); len(errors) != 0 { // NOTE: IsDNS1035Label returns a slice of strings instead of an error, so no wrapping diff --git a/pkg/plugins/external/helpers.go b/pkg/plugins/external/helpers.go index abf7489aa9d..dd06629f6f3 100644 --- a/pkg/plugins/external/helpers.go +++ b/pkg/plugins/external/helpers.go @@ -99,7 +99,7 @@ func makePluginRequest(req external.PluginRequest, path string) (*external.Plugi // Error if the plugin failed. if res.Error { - return nil, fmt.Errorf(strings.Join(res.ErrorMsgs, "\n")) + return nil, fmt.Errorf("%s", strings.Join(res.ErrorMsgs, "\n")) } return &res, nil diff --git a/pkg/plugins/golang/deploy-image/v1alpha1/api.go b/pkg/plugins/golang/deploy-image/v1alpha1/api.go index 14710d7b683..31ad409d69e 100644 --- a/pkg/plugins/golang/deploy-image/v1alpha1/api.go +++ b/pkg/plugins/golang/deploy-image/v1alpha1/api.go @@ -63,14 +63,14 @@ type createAPISubcommand struct { } func (p *createAPISubcommand) UpdateMetadata(cliMeta plugin.CLIMetadata, subcmdMeta *plugin.SubcommandMetadata) { - //nolint: lll + // nolint: lll subcmdMeta.Description = `Scaffold the code implementation to deploy and manage your Operand which is represented by the API informed and will be reconciled by its controller. This plugin will generate the code implementation to help you out. Note: In general, it’s recommended to have one controller responsible for managing each API created for the project to properly follow the design goals set by Controller Runtime(https://github.com/kubernetes-sigs/controller-runtime). This plugin will work as the common behaviour of the flag --force and will scaffold the API and controller always. Use core types or external APIs is not officially support by default with. ` - //nolint: lll + // nolint: lll subcmdMeta.Examples = fmt.Sprintf(` # Create a frigates API with Group: ship, Version: v1beta1, Kind: Frigate to represent the Image: example.com/frigate:v0.0.1 and its controller with a code to deploy and manage this Operand. diff --git a/pkg/plugins/golang/v4/scaffolds/internal/templates/github/lint.go b/pkg/plugins/golang/v4/scaffolds/internal/templates/github/lint.go index 3739a3fc4d0..941f7e00519 100644 --- a/pkg/plugins/golang/v4/scaffolds/internal/templates/github/lint.go +++ b/pkg/plugins/golang/v4/scaffolds/internal/templates/github/lint.go @@ -63,5 +63,5 @@ jobs: - name: Run linter uses: golangci/golangci-lint-action@v6 with: - version: v1.59 + version: v1.61 ` diff --git a/pkg/plugins/golang/v4/scaffolds/internal/templates/golangci.go b/pkg/plugins/golang/v4/scaffolds/internal/templates/golangci.go index f4376036ae4..7a0dca2abe7 100644 --- a/pkg/plugins/golang/v4/scaffolds/internal/templates/golangci.go +++ b/pkg/plugins/golang/v4/scaffolds/internal/templates/golangci.go @@ -65,7 +65,7 @@ linters: enable: - dupl - errcheck - - exportloopref + - copyloopvar - ginkgolinter - goconst - gocyclo diff --git a/pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go b/pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go index 3e71e9341bf..29991ba49f5 100644 --- a/pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go +++ b/pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go @@ -250,7 +250,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint KUSTOMIZE_VERSION ?= {{ .KustomizeVersion }} CONTROLLER_TOOLS_VERSION ?= {{ .ControllerToolsVersion }} ENVTEST_VERSION ?= {{ .EnvtestVersion }} -GOLANGCI_LINT_VERSION ?= v1.59.1 +GOLANGCI_LINT_VERSION ?= v1.61.0 .PHONY: kustomize kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. diff --git a/testdata/project-v4-multigroup/.github/workflows/lint.yml b/testdata/project-v4-multigroup/.github/workflows/lint.yml index b6967b35f4f..f40d36579ce 100644 --- a/testdata/project-v4-multigroup/.github/workflows/lint.yml +++ b/testdata/project-v4-multigroup/.github/workflows/lint.yml @@ -20,4 +20,4 @@ jobs: - name: Run linter uses: golangci/golangci-lint-action@v6 with: - version: v1.59 + version: v1.61 diff --git a/testdata/project-v4-multigroup/.golangci.yml b/testdata/project-v4-multigroup/.golangci.yml index aac8a13f928..6b297462382 100644 --- a/testdata/project-v4-multigroup/.golangci.yml +++ b/testdata/project-v4-multigroup/.golangci.yml @@ -21,7 +21,7 @@ linters: enable: - dupl - errcheck - - exportloopref + - copyloopvar - ginkgolinter - goconst - gocyclo diff --git a/testdata/project-v4-multigroup/Makefile b/testdata/project-v4-multigroup/Makefile index b0152e5a812..d017fa8ec19 100644 --- a/testdata/project-v4-multigroup/Makefile +++ b/testdata/project-v4-multigroup/Makefile @@ -173,7 +173,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint KUSTOMIZE_VERSION ?= v5.5.0 CONTROLLER_TOOLS_VERSION ?= v0.16.4 ENVTEST_VERSION ?= release-0.19 -GOLANGCI_LINT_VERSION ?= v1.59.1 +GOLANGCI_LINT_VERSION ?= v1.61.0 .PHONY: kustomize kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. diff --git a/testdata/project-v4-with-plugins/.github/workflows/lint.yml b/testdata/project-v4-with-plugins/.github/workflows/lint.yml index b6967b35f4f..f40d36579ce 100644 --- a/testdata/project-v4-with-plugins/.github/workflows/lint.yml +++ b/testdata/project-v4-with-plugins/.github/workflows/lint.yml @@ -20,4 +20,4 @@ jobs: - name: Run linter uses: golangci/golangci-lint-action@v6 with: - version: v1.59 + version: v1.61 diff --git a/testdata/project-v4-with-plugins/.golangci.yml b/testdata/project-v4-with-plugins/.golangci.yml index aac8a13f928..6b297462382 100644 --- a/testdata/project-v4-with-plugins/.golangci.yml +++ b/testdata/project-v4-with-plugins/.golangci.yml @@ -21,7 +21,7 @@ linters: enable: - dupl - errcheck - - exportloopref + - copyloopvar - ginkgolinter - goconst - gocyclo diff --git a/testdata/project-v4-with-plugins/Makefile b/testdata/project-v4-with-plugins/Makefile index d8902e789f4..3867f3cf414 100644 --- a/testdata/project-v4-with-plugins/Makefile +++ b/testdata/project-v4-with-plugins/Makefile @@ -173,7 +173,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint KUSTOMIZE_VERSION ?= v5.5.0 CONTROLLER_TOOLS_VERSION ?= v0.16.4 ENVTEST_VERSION ?= release-0.19 -GOLANGCI_LINT_VERSION ?= v1.59.1 +GOLANGCI_LINT_VERSION ?= v1.61.0 .PHONY: kustomize kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. diff --git a/testdata/project-v4/.github/workflows/lint.yml b/testdata/project-v4/.github/workflows/lint.yml index b6967b35f4f..f40d36579ce 100644 --- a/testdata/project-v4/.github/workflows/lint.yml +++ b/testdata/project-v4/.github/workflows/lint.yml @@ -20,4 +20,4 @@ jobs: - name: Run linter uses: golangci/golangci-lint-action@v6 with: - version: v1.59 + version: v1.61 diff --git a/testdata/project-v4/.golangci.yml b/testdata/project-v4/.golangci.yml index aac8a13f928..6b297462382 100644 --- a/testdata/project-v4/.golangci.yml +++ b/testdata/project-v4/.golangci.yml @@ -21,7 +21,7 @@ linters: enable: - dupl - errcheck - - exportloopref + - copyloopvar - ginkgolinter - goconst - gocyclo diff --git a/testdata/project-v4/Makefile b/testdata/project-v4/Makefile index 087497c57f5..f0fbf35e7d2 100644 --- a/testdata/project-v4/Makefile +++ b/testdata/project-v4/Makefile @@ -173,7 +173,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint KUSTOMIZE_VERSION ?= v5.5.0 CONTROLLER_TOOLS_VERSION ?= v0.16.4 ENVTEST_VERSION ?= release-0.19 -GOLANGCI_LINT_VERSION ?= v1.59.1 +GOLANGCI_LINT_VERSION ?= v1.61.0 .PHONY: kustomize kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.