diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 12b4da5b..d72c2e6c 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -16,6 +16,6 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v2.4.0 with: - version: v1.29 + version: v1.36 args: --timeout=5m only-new-issues: true diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 00000000..e358ab27 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,141 @@ +--- +run: + concurrency: 6 + deadline: 5m +linters: + disable-all: true + enable: + - asciicheck + - bodyclose + - deadcode + - depguard + - dogsled + - dupl + - errcheck + - exhaustive + - exportloopref + - gochecknoinits + - gocognit + - goconst + - gocritic + - gocyclo + - godot + - godox + - goerr113 + - gofmt + - gofumpt + - goheader + - goimports + - golint + - gomnd + - gomodguard + - goprintffuncname + - gosec + - gosimple + - govet + - ineffassign + - interfacer + - lll + - maligned + - misspell + - nakedret + - nestif + - noctx + - nolintlint + - paralleltest + - prealloc + - predeclared + - rowserrcheck + - scopelint + - sqlclosecheck + - staticcheck + - structcheck + - stylecheck + - thelper + - tparallel + - typecheck + - unconvert + - unparam + - unused + - varcheck + - whitespace + - wrapcheck +linters-settings: + errcheck: + check-type-assertions: true + check-blank: true + godox: + keywords: + - BUG + - FIXME + - HACK + gocritic: + enabled-checks: + # Diagnostic + - appendAssign + - argOrder + - badCond + - caseOrder + - codegenComment + - commentedOutCode + - deprecatedComment + - dupArg + - dupBranchBody + - dupCase + - dupSubExpr + - exitAfterDefer + - flagDeref + - flagName + - nilValReturn + - offBy1 + - sloppyReassign + - weakCond + - octalLiteral + + # Performance + - appendCombine + - equalFold + - hugeParam + - indexAlloc + - rangeExprCopy + - rangeValCopy + + # Style + - assignOp + - boolExprSimplify + - captLocal + - commentFormatting + - commentedOutImport + - defaultCaseOrder + - docStub + - elseif + - emptyFallthrough + - emptyStringTest + - hexLiteral + - ifElseChain + - methodExprCall + - regexpMust + - singleCaseSwitch + - sloppyLen + - stringXbytes + - switchTrue + - typeAssertChain + - typeSwitchVar + - underef + - unlabelStmt + - unlambda + - unslice + - valSwap + - wrapperFunc + - yodaStyleExpr + + # Opinionated + - builtinShadow + - importShadow + - initClause + - nestingReduce + - paramTypeCombine + - ptrToRefParam + - typeUnparen + - unnamedResult + - unnecessaryBlock diff --git a/Makefile b/Makefile index 601bd77a..fc4f4b12 100644 --- a/Makefile +++ b/Makefile @@ -15,13 +15,12 @@ tidy: GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint golangci-lint: - @[ -f $(GOLANGCI_LINT) ] || { \ + rm -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.29.0 ;\ - } + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.36.0 ;\ lint: golangci-lint ## Run golangci-lint linter - $(GOLANGCI_LINT) run + $(GOLANGCI_LINT) run -n check-env: ifndef GITHUB_AUTH_TOKEN