From 736e1661688f8ed4b263e3b011dbebf5f8629c97 Mon Sep 17 00:00:00 2001 From: koba1t Date: Thu, 9 Mar 2023 05:08:25 +0900 Subject: [PATCH 1/4] update golangci-lint to 1.51.2 --- .golangci.yml | 3 +++ Makefile-tools.mk | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index d6defa7431..1383562b7e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -93,6 +93,9 @@ linters: - interfacebloat - loggercheck - reassign + - ginkgolinter + - gocheckcompilerdirectives + - musttag linters-settings: dupl: diff --git a/Makefile-tools.mk b/Makefile-tools.mk index 45a6789507..ecaa18aa07 100644 --- a/Makefile-tools.mk +++ b/Makefile-tools.mk @@ -1,7 +1,7 @@ # Copyright 2022 The Kubernetes Authors. # SPDX-License-Identifier: Apache-2.0 -GOLANGCI_LINT_VERSION=v1.50.1 +GOLANGCI_LINT_VERSION=v1.51.2 MYGOBIN = $(shell go env GOBIN) ifeq ($(MYGOBIN),) From 39264a7057929ee9f2c9b193d2e18d580b819218 Mon Sep 17 00:00:00 2001 From: koba1t Date: Thu, 9 Mar 2023 05:25:19 +0900 Subject: [PATCH 2/4] use enable-all on golangci-lint --- .golangci.yml | 118 ++++++++++++-------------------------------------- 1 file changed, 28 insertions(+), 90 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 1383562b7e..f07f78ca73 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,96 +6,34 @@ run: go: '1.19' linters: - # please, do not use `enable-all`: it's deprecated and will be removed soon. - # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint - disable-all: true - enable: - - asciicheck - - bidichk - - bodyclose - - contextcheck -# - cyclop - - depguard - - dogsled - - dupl - - dupword - - durationcheck - - errcheck - - errname - - errorlint - - exhaustive -# - exhaustivestruct - - exportloopref -# - forbidigo - - forcetypeassert -# - funlen -# - gci - - gochecknoglobals - - gochecknoinits -# - gocognit - - goconst - - gocritic - - gocyclo -# - godot -# - godox -# - goerr113 - - gofmt -# - gofumpt - - goheader - - goimports - - gomnd - - gomoddirectives - - gomodguard - - goprintffuncname - - gosec - - gosimple - - govet -# - ifshort # too many false positives - - importas - - ineffassign -# - ireturn - - lll - - makezero - - misspell - - nakedret - - nestif - - nilerr -# - nilnil -# - nlreturn -# - noctx - - nolintlint -# - paralleltest - - prealloc - - predeclared - - promlinter - - revive - - rowserrcheck - - sqlclosecheck - - staticcheck -# - stylecheck - - tagliatelle - - tenv - - testpackage - - testableexamples - - thelper - - tparallel - - typecheck - - unconvert - - unparam - - unused -# - varnamelen - - wastedassign - - whitespace - - wrapcheck -# - wsl - - asasalint - - usestdlibvars - - interfacebloat - - loggercheck - - reassign - - ginkgolinter - - gocheckcompilerdirectives - - musttag + enable-all: true + disable: + - cyclop + - exhaustivestruct + - forbidigo + - funlen + - gci + - gocognit + - godot + - godox + - goerr113 + - gofumpt + - ifshort # too many false positives + - ireturn + - nilnil + - nlreturn + - noctx + - paralleltest + - stylecheck + - varnamelen + - wsl + - exhaustruct + - deadcode + - scopelint + - nonamedreturns + - golint + - maintidx + - nosnakecase linters-settings: dupl: From 7d150ce973e60526ea8c490713b241a6472bbbbd Mon Sep 17 00:00:00 2001 From: koba1t Date: Sat, 11 Mar 2023 05:08:25 +0900 Subject: [PATCH 3/4] Revert "use enable-all on golangci-lint" This reverts commit 39264a7057929ee9f2c9b193d2e18d580b819218. --- .golangci.yml | 118 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 90 insertions(+), 28 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index f07f78ca73..1383562b7e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,34 +6,96 @@ run: go: '1.19' linters: - enable-all: true - disable: - - cyclop - - exhaustivestruct - - forbidigo - - funlen - - gci - - gocognit - - godot - - godox - - goerr113 - - gofumpt - - ifshort # too many false positives - - ireturn - - nilnil - - nlreturn - - noctx - - paralleltest - - stylecheck - - varnamelen - - wsl - - exhaustruct - - deadcode - - scopelint - - nonamedreturns - - golint - - maintidx - - nosnakecase + # please, do not use `enable-all`: it's deprecated and will be removed soon. + # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint + disable-all: true + enable: + - asciicheck + - bidichk + - bodyclose + - contextcheck +# - cyclop + - depguard + - dogsled + - dupl + - dupword + - durationcheck + - errcheck + - errname + - errorlint + - exhaustive +# - exhaustivestruct + - exportloopref +# - forbidigo + - forcetypeassert +# - funlen +# - gci + - gochecknoglobals + - gochecknoinits +# - gocognit + - goconst + - gocritic + - gocyclo +# - godot +# - godox +# - goerr113 + - gofmt +# - gofumpt + - goheader + - goimports + - gomnd + - gomoddirectives + - gomodguard + - goprintffuncname + - gosec + - gosimple + - govet +# - ifshort # too many false positives + - importas + - ineffassign +# - ireturn + - lll + - makezero + - misspell + - nakedret + - nestif + - nilerr +# - nilnil +# - nlreturn +# - noctx + - nolintlint +# - paralleltest + - prealloc + - predeclared + - promlinter + - revive + - rowserrcheck + - sqlclosecheck + - staticcheck +# - stylecheck + - tagliatelle + - tenv + - testpackage + - testableexamples + - thelper + - tparallel + - typecheck + - unconvert + - unparam + - unused +# - varnamelen + - wastedassign + - whitespace + - wrapcheck +# - wsl + - asasalint + - usestdlibvars + - interfacebloat + - loggercheck + - reassign + - ginkgolinter + - gocheckcompilerdirectives + - musttag linters-settings: dupl: From e1094da3cf3ef9461c617f98fadb4126accbcb28 Mon Sep 17 00:00:00 2001 From: koba1t Date: Sat, 11 Mar 2023 05:11:47 +0900 Subject: [PATCH 4/4] skip unrelevant lint --- api/internal/localizer/builtinplugins.go | 1 + 1 file changed, 1 insertion(+) diff --git a/api/internal/localizer/builtinplugins.go b/api/internal/localizer/builtinplugins.go index df46bca6cf..c9f48c7c34 100644 --- a/api/internal/localizer/builtinplugins.go +++ b/api/internal/localizer/builtinplugins.go @@ -131,6 +131,7 @@ func (lbp *localizeBuiltinPlugins) localizeAll(node *yaml.RNode) error { // We rely on the build command to throw errors for nodes in // built-in plugins that are sequences when expected to be scalar, // and vice versa. + //nolint: exhaustive switch node.YNode().Kind { case yaml.SequenceNode: return errors.Wrap(node.VisitElements(lbp.localizeScalar))