# This file contains only configs which differ from defaults. # All possible options can be found here: https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml version: "2" run: modules-download-mode: readonly tests: true linters: default: none enable: - asasalint - asciicheck - bidichk - bodyclose - contextcheck - copyloopvar - decorder - durationcheck - errname - errorlint - gocritic - goheader - gomoddirectives - gomodguard_v2 - gosec - govet - ineffassign - makezero - misspell - nilerr - nilnil - nolintlint - nosprintfhostport - predeclared - promlinter - revive - rowserrcheck - sqlclosecheck - staticcheck - tparallel - unconvert - unused - usetesting - wastedassign - whitespace settings: cyclop: # The maximal code complexity to report. # Default: 10 max-complexity: 30 # The maximal average package complexity. # If it's higher than 0.0 (float) the check is enabled # Default: 0.0 package-average: 10 dupl: threshold: 100 errcheck: # Report about not checking of errors in type assertions: `a := b.(MyStruct)`. # Such cases aren't reported by default. # Default: false check-type-assertions: true funlen: # Checks the number of lines in a function. # If lower than 0, disable the check. # Default: 60 lines: 100 # Checks the number of statements in a function. # If lower than 0, disable the check. # Default: 40 statements: 50 gocognit: # Minimal code complexity to report # Default: 30 (but we recommend 10-20) min-complexity: 20 goconst: min-len: 2 min-occurrences: 2 gocritic: disabled-checks: - commentFormatting - commentedOutCode - hugeParam - octalLiteral - rangeValCopy - tooManyResultsChecker - unnamedResult enabled-tags: - performance - style - experimental - diagnostic # Settings passed to gocritic. # The settings key is the name of a supported gocritic checker. # The list of supported checkers can be find in https://go-critic.github.io/overview. settings: # Whether to restrict checker to params only. # Default: true captLocal: paramsOnly: false underef: # Whether to skip (*x).method() calls where x is a pointer receiver. # Default: true skipRecvDeref: false gocyclo: min-complexity: 10 gomoddirectives: replace-allow-list: - go.mozilla.org/pkcs7 - go.step.sm/rpc - github.com/elimity-com/scim - github.com/google/go-attestation # temporarily replaced with github.com/smallstep/go-attestation till changes are in upstream - github.com/smallstep/certificates # temporarily replace with github.com/smallstep/internal-certificates - github.com/google/go-tpm # temporarily replaced until https://github.com/google/go-tpm/pull/420 is merged replace-local: true gomodguard_v2: # List of blocked modules. # Default: [] blocked: - module: github.com/golang/protobuf recommendations: - google.golang.org/protobuf reason: see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules - module: github.com/satori/go.uuid recommendations: - github.com/google/uuid reason: satori's package is not maintained - module: github.com/gofrs/uuid recommendations: - github.com/google/uuid reason: 'see recommendation from dev-infra team: https://confluence.gtforge.com/x/gQI6Aw' govet: # Disable analyzers by name. # Run `go tool vet help` to see all analyzers. # Default: [] disable: - fieldalignment - inline # Enable all analyzers. # Default: false enable-all: true # Settings per analyzer. settings: printf: funcs: - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf lll: line-length: 140 misspell: locale: US # Make an issue if func has more lines of code than this setting, and it has naked returns. # Default: 30 nakedret: max-func-lines: 0 nolintlint: # Enable to require an explanation of nonzero length after each nolint directive. # Default: false require-explanation: true # Enable to require nolint directives to mention the specific linter being suppressed. # Default: false require-specific: true # Exclude following linters from requiring an explanation. # Default: [] allow-no-explanation: - funlen - gocognit - lll revive: confidence: 0 rules: - name: var-naming arguments: - [] # AllowList - [] # DenyList - - skip-package-name-checks: true rowserrcheck: # database/sql is always checked # Default: [] packages: - github.com/jmoiron/sqlx staticcheck: checks: # Enable all rules by default - all # Omit embedded fields from selector expression. # https://staticcheck.dev/docs/checks/#QF1008 - -QF1008 usetesting: context-background: false context-todo: false exclusions: generated: lax presets: - comments - common-false-positives - legacy - std-error-handling rules: - linters: - lll source: ^//\s*go:generate\s - linters: - godot source: (noinspection|TODO) - linters: - gocritic source: //noinspection - linters: - errorlint source: ^\s+if _, ok := err\.\([^.]+\.InternalError\); ok { - linters: - bodyclose - contextcheck - dupl - errcheck - funlen - goconst - gosec - nilnil - noctx - nolintlint - revive - whitespace - wrapcheck path: _test\.go - path: (.+)\.go$ text: declaration of "err" shadows declaration at line - path: (.+)\.go$ text: should have a package comment, unless it's in another file for this package - path: (.+)\.go$ text: func `CLICommand. - path: (.+)\.go$ text: error strings should not be capitalized or end with punctuation or a newline - path: (.+)\.go$ text: Function `URLParam->URLParam` should pass the context parameter - path: (.+)\.go$ text: Function `URLParam` should pass the context parameter - path: (.+)\.go$ text: Potentially accessing slice out of bounds paths: - third_party$ - builtin$ - examples$ issues: # Maximum count of issues with the same text. # Set to 0 to disable. # Default: 3 max-same-issues: 50 formatters: enable: - goimports exclusions: generated: lax paths: - third_party$ - builtin$ - examples$