|
| 1 | +linters-settings: |
| 2 | + depguard: |
| 3 | + list-type: blacklist |
| 4 | + dupl: |
| 5 | + threshold: 450 |
| 6 | + funlen: |
| 7 | + lines: 220 |
| 8 | + statements: 100 |
| 9 | + goconst: |
| 10 | + min-len: 2 |
| 11 | + min-occurrences: 2 |
| 12 | + gocritic: |
| 13 | + enabled-tags: |
| 14 | + - diagnostic |
| 15 | + - experimental |
| 16 | + - opinionated |
| 17 | + - performance |
| 18 | + - style |
| 19 | + disabled-checks: |
| 20 | + - dupImport # https://github.com/go-critic/go-critic/issues/845 |
| 21 | + - ifElseChain |
| 22 | + - octalLiteral |
| 23 | + - whyNoLint |
| 24 | + - wrapperFunc |
| 25 | + gocyclo: |
| 26 | + min-complexity: 20 |
| 27 | + goimports: |
| 28 | + local-prefixes: github.com/golangci/golangci-lint |
| 29 | + gomnd: |
| 30 | + settings: |
| 31 | + mnd: |
| 32 | + # don't include the "operation" and "assign" |
| 33 | + checks: argument,case,condition,return |
| 34 | + ignored-numbers: 1,2,10 |
| 35 | + govet: |
| 36 | + check-shadowing: true |
| 37 | + settings: |
| 38 | + printf: |
| 39 | + funcs: |
| 40 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof |
| 41 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf |
| 42 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf |
| 43 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf |
| 44 | + lll: |
| 45 | + line-length: 140 |
| 46 | + maligned: |
| 47 | + suggest-new: true |
| 48 | + misspell: |
| 49 | + locale: US |
| 50 | + |
| 51 | +linters: |
| 52 | + # please, do not use `enable-all`: it's deprecated and will be removed soon. |
| 53 | + # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint |
| 54 | + disable-all: true |
| 55 | + enable: |
| 56 | + - bodyclose |
| 57 | + - dogsled |
| 58 | + - dupl |
| 59 | + - errcheck |
| 60 | + - funlen |
| 61 | + - gochecknoinits |
| 62 | + - goconst |
| 63 | + - gocritic |
| 64 | + - gocyclo |
| 65 | + - gofmt |
| 66 | + - goimports |
| 67 | + - gomnd |
| 68 | + - goprintffuncname |
| 69 | + - gosec |
| 70 | + - gosimple |
| 71 | + - govet |
| 72 | + - ineffassign |
| 73 | + - lll |
| 74 | + - misspell |
| 75 | + - nakedret |
| 76 | + - rowserrcheck |
| 77 | + - exportloopref |
| 78 | + - staticcheck |
| 79 | + - stylecheck |
| 80 | + - typecheck |
| 81 | + - unconvert |
| 82 | + - unparam |
| 83 | + - unused |
| 84 | + - whitespace |
| 85 | + |
| 86 | + # don't enable: |
| 87 | + # - gochecknoglobals |
| 88 | + # - gocognit |
| 89 | + # - godox |
| 90 | + # - maligned |
| 91 | + # - prealloc |
| 92 | + |
| 93 | +issues: |
| 94 | + # Excluding configuration per-path, per-linter, per-text and per-source |
| 95 | + exclude-rules: |
| 96 | + - path: / |
| 97 | + linters: |
| 98 | + - typecheck # why this is disabled? Because golangci-lint in its latest version was compiled against go 1.21 |
| 99 | + # and the code we are linting is compiled against go 1.22.1 and we KNOW that it builds so it should |
| 100 | + # not have typecheck errors, but indeed if we do not disabled it we get typecheck errors that are false positives |
| 101 | + # so we need to disable it, but because in the pipelines there is a step that ensures that the code builds |
| 102 | + # having this disabled is not an issue, and if golangci-lint gets update in a way that does not give false positives |
| 103 | + # then we can enabled it again, but that would still be rechecing again what another step is already checking (the build step) |
| 104 | + # ref: https://github.com/golangci/golangci-lint/issues/3718 |
| 105 | + - path: _test\.go |
| 106 | + linters: |
| 107 | + - gomnd |
| 108 | + - gosec |
| 109 | + - staticcheck |
| 110 | + - lll |
| 111 | + - gocritic |
| 112 | + |
| 113 | +run: |
| 114 | + skip-dirs: |
| 115 | + - test/testdata_etc |
| 116 | + - internal/cache |
| 117 | + - internal/renameio |
| 118 | + - internal/robustio |
| 119 | + |
| 120 | +# golangci.com configuration |
| 121 | +# https://github.com/golangci/golangci/wiki/Configuration |
| 122 | +service: |
| 123 | + golangci-lint-version: 1.42.1 # use the fixed version to not introduce new linters unexpectedly |
| 124 | + prepare: |
| 125 | + - echo "here I can run custom commands, but no preparation needed for this repo" |
0 commit comments