|
| 1 | +# https://golangci-lint.run/usage/configuration/ |
| 2 | +run: |
| 3 | + timeout: 10m |
| 4 | + |
| 5 | + # If set we pass it to "go list -mod={option}". From "go help modules": |
| 6 | + # If invoked with -mod=readonly, the go command is disallowed from the implicit |
| 7 | + # automatic updating of go.mod described above. Instead, it fails when any changes |
| 8 | + # to go.mod are needed. This setting is most useful to check that go.mod does |
| 9 | + # not need updates, such as in a continuous integration and testing system. |
| 10 | + # If invoked with -mod=vendor, the go command assumes that the vendor |
| 11 | + # directory holds the correct copies of dependencies and ignores |
| 12 | + # the dependency descriptions in go.mod. |
| 13 | + # |
| 14 | + # Allowed values: readonly|vendor|mod |
| 15 | + # By default, it isn't set. |
| 16 | + modules-download-mode: readonly |
| 17 | + |
| 18 | +issues: |
| 19 | + # Make issues output unique by line. |
| 20 | + # Default: true |
| 21 | + uniq-by-line: false |
| 22 | + |
| 23 | + # Maximum issues count per one linter. |
| 24 | + # Set to 0 to disable. |
| 25 | + # Default: 50 |
| 26 | + max-issues-per-linter: 0 |
| 27 | + |
| 28 | + # Maximum count of issues with the same text. |
| 29 | + # Set to 0 to disable. |
| 30 | + # Default: 3 |
| 31 | + max-same-issues: 0 |
| 32 | + |
| 33 | + # Enables skipping of directories: |
| 34 | + # - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ |
| 35 | + # Default: true |
| 36 | + exclude-dirs-use-default: false |
| 37 | + |
| 38 | +linters: |
| 39 | + disable-all: true |
| 40 | + enable: |
| 41 | + - asciicheck |
| 42 | + - bodyclose |
| 43 | + - copyloopvar |
| 44 | + - depguard |
| 45 | + - dupword |
| 46 | + - dupl |
| 47 | + - errcheck |
| 48 | + - errname |
| 49 | + - errorlint |
| 50 | + - forbidigo |
| 51 | + - gci |
| 52 | + - goconst |
| 53 | + - gocritic |
| 54 | + # - err113 - encourages wrapping static errors |
| 55 | + - gofmt |
| 56 | + - gofumpt |
| 57 | + # - mnd - unnecessary magic numbers |
| 58 | + - goprintffuncname |
| 59 | + - gosec |
| 60 | + - gosimple |
| 61 | + - govet |
| 62 | + - importas |
| 63 | + - ineffassign |
| 64 | + # - lll line length linter |
| 65 | + - misspell |
| 66 | + - nakedret |
| 67 | + - nilerr |
| 68 | + - noctx |
| 69 | + - nolintlint |
| 70 | + - perfsprint |
| 71 | + - prealloc |
| 72 | + - predeclared |
| 73 | + - revive |
| 74 | + - spancheck |
| 75 | + - staticcheck |
| 76 | + - stylecheck |
| 77 | + - tagalign |
| 78 | + - testifylint |
| 79 | + - typecheck |
| 80 | + - unconvert |
| 81 | + - unparam |
| 82 | + - unused |
| 83 | + - usestdlibvars |
| 84 | + - whitespace |
| 85 | + |
| 86 | +linters-settings: |
| 87 | + depguard: |
| 88 | + rules: |
| 89 | + packages: |
| 90 | + deny: |
| 91 | + - pkg: "github.com/golang/mock/gomock" |
| 92 | + desc: go.uber.org/mock/gomock should be used instead. |
| 93 | + - pkg: "github.com/stretchr/testify/assert" |
| 94 | + desc: github.com/stretchr/testify/require should be used instead. |
| 95 | + - pkg: "io/ioutil" |
| 96 | + desc: io/ioutil is deprecated. Use package io or os instead. |
| 97 | + errorlint: |
| 98 | + # Check for plain type assertions and type switches. |
| 99 | + asserts: false |
| 100 | + # Check for plain error comparisons. |
| 101 | + comparison: false |
| 102 | + forbidigo: |
| 103 | + # Forbid the following identifiers (list of regexp). |
| 104 | + forbid: |
| 105 | + - 'require\.Error$(# ErrorIs should be used instead)?' |
| 106 | + - 'require\.ErrorContains$(# ErrorIs should be used instead)?' |
| 107 | + - 'require\.EqualValues$(# Equal should be used instead)?' |
| 108 | + - 'require\.NotEqualValues$(# NotEqual should be used instead)?' |
| 109 | + - '^(t|b|tb|f)\.(Fatal|Fatalf|Error|Errorf)$(# the require library should be used instead)?' |
| 110 | + revive: |
| 111 | + rules: |
| 112 | + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr |
| 113 | + - name: bool-literal-in-expr |
| 114 | + disabled: false |
| 115 | + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return |
| 116 | + - name: early-return |
| 117 | + disabled: false |
| 118 | + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines |
| 119 | + - name: empty-lines |
| 120 | + disabled: false |
| 121 | + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format |
| 122 | + - name: string-format |
| 123 | + disabled: false |
| 124 | + arguments: |
| 125 | + - ["b.Logf[0]", "/.*%.*/", "no format directive, use b.Log instead"] |
| 126 | + - ["fmt.Errorf[0]", "/.*%.*/", "no format directive, use errors.New instead"] |
| 127 | + - ["fmt.Fprintf[1]", "/.*%.*/", "no format directive, use fmt.Fprint instead"] |
| 128 | + - ["fmt.Printf[0]", "/.*%.*/", "no format directive, use fmt.Print instead"] |
| 129 | + - ["fmt.Sprintf[0]", "/.*%.*/", "no format directive, use fmt.Sprint instead"] |
| 130 | + - ["log.Fatalf[0]", "/.*%.*/", "no format directive, use log.Fatal instead"] |
| 131 | + - ["log.Printf[0]", "/.*%.*/", "no format directive, use log.Print instead"] |
| 132 | + - ["t.Logf[0]", "/.*%.*/", "no format directive, use t.Log instead"] |
| 133 | + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag |
| 134 | + - name: struct-tag |
| 135 | + disabled: false |
| 136 | + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-naming |
| 137 | + - name: unexported-naming |
| 138 | + disabled: false |
| 139 | + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error |
| 140 | + - name: unhandled-error |
| 141 | + # prefer the errcheck linter since it can be disabled directly with nolint directive |
| 142 | + # but revive's disable directive (e.g. //revive:disable:unhandled-error) is not |
| 143 | + # supported when run under golangci_lint |
| 144 | + disabled: true |
| 145 | + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter |
| 146 | + - name: unused-parameter |
| 147 | + disabled: false |
| 148 | + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver |
| 149 | + - name: unused-receiver |
| 150 | + disabled: false |
| 151 | + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break |
| 152 | + - name: useless-break |
| 153 | + disabled: false |
| 154 | + tagalign: |
| 155 | + align: true |
| 156 | + sort: true |
| 157 | + strict: true |
| 158 | + order: |
| 159 | + - serialize |
| 160 | + testifylint: |
| 161 | + # Enable all checkers (https://github.com/Antonboom/testifylint#checkers). |
| 162 | + # Default: false |
| 163 | + enable-all: true |
| 164 | + # Disable checkers by name |
| 165 | + # (in addition to default |
| 166 | + # suite-thelper |
| 167 | + # ). |
| 168 | + disable: |
| 169 | + - go-require |
| 170 | + - float-compare |
0 commit comments