# See the dedicated "version" documentation section. version: "2" linters: # Default set of linters. # The value can be: # - `standard`: https://golangci-lint.run/docs/linters/#enabled-by-default # - `all`: enables all linters by default. # - `none`: disables all linters by default. # - `fast`: enables only linters considered as "fast" (`golangci-lint help linters --json | jq '[ .[] | select(.fast==true) ] | map(.name)'`). # Default: standard default: all # Enable specific linter. enable: - arangolint - asasalint - asciicheck - bidichk - bodyclose - canonicalheader - containedctx - contextcheck - copyloopvar - cyclop - decorder - dogsled - dupl - dupword - durationcheck - embeddedstructfieldcheck - err113 - errcheck - errchkjson - errname - errorlint - exhaustive - exptostd - fatcontext - forbidigo - forcetypeassert - funcorder - funlen - ginkgolinter - gocheckcompilerdirectives - gochecknoglobals - gochecknoinits - gochecksumtype - gocognit - goconst - gocritic - gocyclo - godoclint - godot - godox - goheader - gomodguard - goprintffuncname - gosec - gosmopolitan - govet - grouper - iface - importas - inamedparam - ineffassign - interfacebloat - intrange - iotamixing - ireturn - lll - loggercheck - maintidx - makezero - mirror - misspell - mnd - modernize - musttag - nakedret - nestif - nilerr - nilnesserr - nilnil - nlreturn - noctx - noinlineerr - nolintlint - nonamedreturns - nosprintfhostport - paralleltest - perfsprint - prealloc - predeclared - promlinter - protogetter - reassign - recvcheck - revive - rowserrcheck - sloglint - spancheck - sqlclosecheck - staticcheck - tagalign - tagliatelle - testableexamples - testifylint - testpackage - thelper - tparallel - unconvert - unparam - unqueryvet - unused - usestdlibvars - usetesting - varnamelen - wastedassign - whitespace - wsl_v5 - zerologlint # Disable specific linters. disable: - depguard - exhaustruct - gochecknoglobals - gomoddirectives - wsl - wrapcheck # All available settings of specific linters. # See the dedicated "linters.settings" documentation section. settings: wsl_v5: allow-first-in-block: true allow-whole-block: false branch-max-lines: 2 # Defines a set of rules to ignore issues. # It does not skip the analysis, and so does not ignore "typecheck" errors. exclusions: # Mode of the generated files analysis. # # - `strict`: sources are excluded by strictly following the Go generated file convention. # Source files that have lines matching only the following regular expression will be excluded: `^// Code generated .* DO NOT EDIT\.$` # This line must appear before the first non-comment, non-blank text in the file. # https://go.dev/s/generatedcode # - `lax`: sources are excluded if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc. # - `disable`: disable the generated files exclusion. # # Default: strict generated: lax # Log a warning if an exclusion rule is unused. # Default: false warn-unused: true # Predefined exclusion rules. # Default: [] presets: - comments - std-error-handling - common-false-positives - legacy # Excluding configuration per-path, per-linter, per-text and per-source. rules: # Exclude some linters from running on tests files. - path: _test\.go linters: - funlen - gocyclo - errcheck - dupl - gosec # Run some linter only for test files by excluding its issues for everything else. - path-except: _test\.go linters: - forbidigo # Exclude known linters from partially hard-vendored code, # which is impossible to exclude via `nolint` comments. # `/` will be replaced by the current OS file path separator to properly work on Windows. - path: internal/hmac/ text: "weak cryptographic primitive" linters: - gosec # Exclude some `staticcheck` messages. - linters: - staticcheck text: "SA9003:" # Exclude `lll` issues for long lines with `go:generate`. - linters: - lll source: "^//go:generate " # Which file paths to exclude: they will be analyzed, but issues from them won't be reported. # "/" will be replaced by the current OS file path separator to properly work on Windows. # Default: [] paths: [] # Which file paths to not exclude. # Default: [] paths-except: []