diff --git a/.golangci.yml b/.golangci.yml index f5ab856eb0..4c617d20d0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,39 +5,69 @@ run: linters: disable-all: true enable: + - asasalint + - bidichk + - containedctx + - decorder - dupl + - dupword - durationcheck + - errname + - execinquery - forcetypeassert + - gocheckcompilerdirectives + - gochecksumtype - gofmt - goimports + - gosmopolitan - govet + - grouper - importas + - inamedparam - ineffassign + - interfacebloat + - loggercheck + - maintidx - makezero + - mirror - misspell + - musttag - nakedret - nilerr + - nosprintfhostport - prealloc - predeclared - promlinter + - protogetter + - reassign + - sloglint - staticcheck + - tagalign - tagliatelle + - tenv + - testableexamples + - testifylint - typecheck - unused + - usestdlibvars - wastedassign + - zerologlint # - asciicheck # - bodyclose + # - contextcheck # - cyclop # - depguard # - dogsled # - errcheck + # - errchkjson # - errorlint # - exhaustive - # - exhaustivestruct + # - exhaustruct # - exportloopref # - forbidigo # - funlen # - gci + # - ginkgolinter # - gochecknoglobals # - gochecknoinits # - gocognit @@ -49,23 +79,24 @@ linters: # - goerr113 # - gofumpt # - goheader - # - golint # - gomnd # - gomoddirectives # - gomodguard # - goprintffuncname # - gosec # - gosimple - # - ifshort + # - ireturn # - lll # - nestif + # - nilnil # - nlreturn # - noctx # - nolintlint + # - nonamedreturns # - paralleltest + # - perfsprint # - revive # - rowserrcheck - # - scopelint # - sqlclosecheck # - stylecheck # - testpackage @@ -73,6 +104,7 @@ linters: # - tparallel # - unconvert # - unparam + # - varnamelen # - whitespace # - wrapcheck # - wsl @@ -81,71 +113,109 @@ linters-settings: checks: ["SA1019"] gocritic: enabled-checks: - # Diagnostic - appendAssign + - appendCombine - argOrder + - assignOp + - badCall - badCond + - badLock + - badRegexp + - badSorting + - boolExprSimplify + - builtinShadow + - builtinShadowDecl + - captLocal - caseOrder - codegenComment + - commentFormatting - commentedOutCode + - commentedOutImport + - defaultCaseOrder + - deferInLoop + - deferUnlambda - deprecatedComment + - docStub - dupArg - dupBranchBody - dupCase + - dupImport - dupSubExpr + - dynamicFmtString + - elseif + - emptyDecl + - emptyFallthrough + - emptyStringTest + - equalFold + - evalOrder - exitAfterDefer + - exposedSyncMutex + - externalErrorReassign + - filepathJoin - flagDeref - flagName - - nilValReturn - - offBy1 - - sloppyReassign - - weakCond - - octalLiteral - - # Performance - - appendCombine - - equalFold + - hexLiteral + - httpNoBody - hugeParam + - ifElseChain + - importShadow - indexAlloc + - initClause + - mapKey + - methodExprCall + - nestingReduce + - newDeref + - nilValReturn + - octalLiteral + - offBy1 + - paramTypeCombine + - preferDecodeRune + - preferFilepathJoin + - preferFprint + - preferStringWriter + - preferWriteByte + - ptrToRefParam - rangeExprCopy - rangeValCopy - - # Style - - assignOp - - boolExprSimplify - - captLocal - - commentFormatting - - commentedOutImport - - defaultCaseOrder - - docStub - - elseif - - emptyFallthrough - - emptyStringTest - - hexLiteral - - ifElseChain - - methodExprCall + - redundantSprint - regexpMust + - regexpPattern + - regexpSimplify + - returnAfterHttpError + - ruleguard - singleCaseSwitch + - sliceClear - sloppyLen + - sloppyReassign + - sloppyTestFuncName + - sloppyTypeAssert + - sortSlice + - sprintfQuotedString + - sqlQuery + - stringConcatSimplify - stringXbytes + - stringsCompare - switchTrue + - syncMapLoadAndDelete + - timeCmpSimplify + - timeExprSimplify + - todoCommentWithoutDetail + - tooManyResultsChecker + - truncateCmp - typeAssertChain + - typeDefFirst - typeSwitchVar + - typeUnparen + - uncheckedInlineErr - underef - unlabelStmt - unlambda + - unnamedResult + - unnecessaryBlock + - unnecessaryDefer - unslice - valSwap + - weakCond + - whyNoLint - wrapperFunc - yodaStyleExpr - - # Opinionated - - builtinShadow - - importShadow - - initClause - - nestingReduce - - paramTypeCombine - - ptrToRefParam - - typeUnparen - - unnamedResult - - unnecessaryBlock diff --git a/Makefile b/Makefile index 42f11cf6d1..18dc4ba6ff 100644 --- a/Makefile +++ b/Makefile @@ -113,7 +113,7 @@ install.lint: $(GOLANGCI_LINT) $(GOLANGCI_LINT): export \ - VERSION=v1.52.2 \ + VERSION=v1.55.2 \ URL=https://raw.githubusercontent.com/golangci/golangci-lint \ BINDIR=${BUILD_BIN_PATH} && \ curl -sfL $$URL/$$VERSION/install.sh | sh -s $$VERSION diff --git a/cmd/crictl/image.go b/cmd/crictl/image.go index 720a3c5c75..3568a81e3e 100644 --- a/cmd/crictl/image.go +++ b/cmd/crictl/image.go @@ -72,7 +72,7 @@ var pullImageCommand = &cli.Command{ &cli.StringFlag{ Name: "pod-config", Value: "", - Usage: "Use `pod-config.[json|yaml]` to override the the pull c", + Usage: "Use `pod-config.[json|yaml]` to override the pull c", TakesFile: true, }, &cli.StringSliceFlag{ diff --git a/pkg/validate/networking.go b/pkg/validate/networking.go index 7a9aab2c0c..96abcc7360 100644 --- a/pkg/validate/networking.go +++ b/pkg/validate/networking.go @@ -85,7 +85,7 @@ var _ = framework.KubeDescribe("Networking", func() { }) It("runtime should support port mapping with only container port [Conformance]", func() { - By("create a PodSandbox with container port port mapping") + By("create a PodSandbox with container port mapping") var podConfig *runtimeapi.PodSandboxConfig portMappings := []*runtimeapi.PortMapping{ { @@ -105,7 +105,7 @@ var _ = framework.KubeDescribe("Networking", func() { }) It("runtime should support port mapping with host port and container port [Conformance]", func() { - By("create a PodSandbox with host port and container port port mapping") + By("create a PodSandbox with host port and container port mapping") var podConfig *runtimeapi.PodSandboxConfig portMappings := []*runtimeapi.PortMapping{ { diff --git a/pkg/validate/streaming.go b/pkg/validate/streaming.go index 2d0d1ceebb..0c86b98e21 100644 --- a/pkg/validate/streaming.go +++ b/pkg/validate/streaming.go @@ -123,7 +123,7 @@ var _ = framework.KubeDescribe("Streaming", func() { }) It("runtime should support portforward [Conformance]", func() { - By("create a PodSandbox with container port port mapping") + By("create a PodSandbox with container port mapping") var podConfig *runtimeapi.PodSandboxConfig portMappings := []*runtimeapi.PortMapping{ { diff --git a/pkg/validate/streaming_linux.go b/pkg/validate/streaming_linux.go index d24a2fffc9..6ead0b4928 100644 --- a/pkg/validate/streaming_linux.go +++ b/pkg/validate/streaming_linux.go @@ -48,7 +48,7 @@ var _ = framework.KubeDescribe("Streaming", func() { }) It("runtime should support portforward in host network", func() { - By("create a PodSandbox with container port port mapping in host network") + By("create a PodSandbox with container port mapping in host network") var podConfig *runtimeapi.PodSandboxConfig portMappings := []*runtimeapi.PortMapping{ {