|
| 1 | +issues: |
| 2 | + exclude-dirs: |
| 3 | + - 'bin' |
| 4 | + - 'tmp' |
| 5 | + exclude-rules: |
| 6 | + - path: _test\.go |
| 7 | + linters: |
| 8 | + - forcetypeassert |
| 9 | + |
| 10 | +linters-settings: |
| 11 | + # https://golangci-lint.run/usage/linters/#misspell |
| 12 | + misspell: |
| 13 | + mode: restricted |
| 14 | + # https://golangci-lint.run/usage/linters/#asasalint |
| 15 | + asasalint: |
| 16 | + ignore-test: true |
| 17 | + # https://golangci-lint.run/usage/linters/#exhaustive |
| 18 | + exhaustive: |
| 19 | + default-signifies-exhaustive: true |
| 20 | + # https://golangci-lint.run/usage/linters/#predeclared |
| 21 | + predeclared: |
| 22 | + ignore: "new,error" |
| 23 | + # https://golangci-lint.run/usage/linters/#gocritic |
| 24 | + gocritic: |
| 25 | + disabled-checks: |
| 26 | + - ifElseChain |
| 27 | + - commentFormatting |
| 28 | + # https://golangci-lint.run/usage/linters/#testifylint |
| 29 | + testifylint: |
| 30 | + disable: |
| 31 | + - float-compare |
| 32 | + # https://golangci-lint.run/usage/linters/#gosec |
| 33 | + gosec: |
| 34 | + confidence: medium |
| 35 | + excludes: |
| 36 | + - G204 |
| 37 | + # https://golangci-lint.run/usage/linters/#importas |
| 38 | + importas: |
| 39 | + no-unaliased: true |
| 40 | + # https://golangci-lint.run/usage/linters/#gomoddirectives |
| 41 | + gomoddirectives: |
| 42 | + replace-local: true |
| 43 | + # https://golangci-lint.run/usage/linters/#revive |
| 44 | + revive: |
| 45 | + ignore-generated-header: true |
| 46 | + enable-all-rules: true |
| 47 | + rules: |
| 48 | + - name: line-length-limit |
| 49 | + disabled: true |
| 50 | + - name: cognitive-complexity |
| 51 | + disabled: true |
| 52 | + - name: unused-parameter |
| 53 | + disabled: true |
| 54 | + - name: add-constant |
| 55 | + disabled: true |
| 56 | + - name: cyclomatic |
| 57 | + disabled: true |
| 58 | + - name: function-length |
| 59 | + disabled: true |
| 60 | + - name: function-result-limit |
| 61 | + disabled: true |
| 62 | + - name: flag-parameter |
| 63 | + disabled: true |
| 64 | + - name: unused-receiver |
| 65 | + disabled: true |
| 66 | + - name: argument-limit |
| 67 | + disabled: true |
| 68 | + - name: max-control-nesting |
| 69 | + disabled: true |
| 70 | + - name: comment-spacings |
| 71 | + disabled: true |
| 72 | + - name: struct-tag |
| 73 | + arguments: |
| 74 | + - "json,inline" |
| 75 | + - "yaml,squash" |
| 76 | + - name: unhandled-error |
| 77 | + arguments: |
| 78 | + - "fmt.Println" |
| 79 | + - "viper.BindPFlag" |
| 80 | + - "strings.Builder.WriteString" |
| 81 | + |
| 82 | +linters: |
| 83 | + disable-all: true |
| 84 | + enable: |
| 85 | + ## Enabled by default linters: |
| 86 | + - errcheck # errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases [fast: false, auto-fix: false] |
| 87 | + - gosimple # (megacheck) Linter for Go source code that specializes in simplifying code [fast: false, auto-fix: false] |
| 88 | + - govet # (vet, vetshadow) Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes. [fast: false, auto-fix: false] |
| 89 | + - ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false] |
| 90 | + - staticcheck # (megacheck) It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint. [fast: false, auto-fix: false] |
| 91 | + - unused # (megacheck) Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false] |
| 92 | + |
| 93 | + ## Disabled by your configuration linters: |
| 94 | + - asasalint # check for pass []any as any in variadic func(...any) [fast: false, auto-fix: false] |
| 95 | + - asciicheck # checks that all code identifiers does not have non-ASCII symbols in the name [fast: true, auto-fix: false] |
| 96 | + - bidichk # Checks for dangerous unicode character sequences [fast: true, auto-fix: false] |
| 97 | + - bodyclose # checks whether HTTP response body is closed successfully [fast: false, auto-fix: false] |
| 98 | + - containedctx # containedctx is a linter that detects struct contained context.Context field [fast: false, auto-fix: false] |
| 99 | + - contextcheck # check whether the function uses a non-inherited context [fast: false, auto-fix: false] |
| 100 | + - copyloopvar # (go >= 1.22) copyloopvar is a linter detects places where loop variables are copied [fast: true, auto-fix: false] |
| 101 | + - decorder # check declaration order and count of types, constants, variables and functions [fast: true, auto-fix: false] |
| 102 | + - durationcheck # check for two durations multiplied together [fast: false, auto-fix: false] |
| 103 | + - errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and reports occations, where the check for the returned error can be omitted. [fast: false, auto-fix: false] |
| 104 | + - errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`. [fast: false, auto-fix: false] |
| 105 | + - errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. [fast: false, auto-fix: false] |
| 106 | + - exhaustive # check exhaustiveness of enum switch statements [fast: false, auto-fix: false] |
| 107 | + #- forbidigo # Forbids identifiers [fast: false, auto-fix: false] |
| 108 | + - forcetypeassert # finds forced type assertions [fast: true, auto-fix: false] |
| 109 | + - gocheckcompilerdirectives # Checks that go compiler directive comments (//go:) are valid. [fast: true, auto-fix: false] |
| 110 | + - gochecksumtype # Run exhaustiveness checks on Go "sum types" [fast: false, auto-fix: false] |
| 111 | + - goconst # Finds repeated strings that could be replaced by a constant [fast: true, auto-fix: false] |
| 112 | + - gocritic # Provides diagnostics that check for bugs, performance and style issues. [fast: false, auto-fix: true] |
| 113 | + - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true] |
| 114 | + - goheader # Checks is file header matches to pattern [fast: true, auto-fix: true] |
| 115 | + - goimports # Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode. [fast: true, auto-fix: true] |
| 116 | + - gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. [fast: true, auto-fix: false] |
| 117 | + - gomodguard # Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations. [fast: true, auto-fix: false] |
| 118 | + - goprintffuncname # Checks that printf-like functions are named with `f` at the end. [fast: true, auto-fix: false] |
| 119 | + - gosec # (gas) Inspects source code for security problems [fast: false, auto-fix: false] |
| 120 | + - gosmopolitan # Report certain i18n/l10n anti-patterns in your Go codebase [fast: false, auto-fix: false] |
| 121 | + - grouper # Analyze expression groups. [fast: true, auto-fix: false] |
| 122 | + - importas # Enforces consistent import aliases [fast: false, auto-fix: false] |
| 123 | + - inamedparam # reports interfaces with unnamed method parameters [fast: true, auto-fix: false] |
| 124 | + - intrange # (go >= 1.22) intrange is a linter to find places where for loops could make use of an integer range. [fast: true, auto-fix: false] |
| 125 | + - loggercheck # (logrlint) Checks key value pairs for common logger libraries (kitlog,klog,logr,zap). [fast: false, auto-fix: false] |
| 126 | + - makezero # Finds slice declarations with non-zero initial length [fast: false, auto-fix: false] |
| 127 | + - misspell # Finds commonly misspelled English words [fast: true, auto-fix: true] |
| 128 | + - mirror # reports wrong mirror patterns of bytes/strings usage [fast: false, auto-fix: true] |
| 129 | + - musttag # enforce field tags in (un)marshaled structs [fast: false, auto-fix: false] |
| 130 | + - nakedret # Checks that functions with naked returns are not longer than a maximum size (can be zero). [fast: true, auto-fix: false] |
| 131 | + - nilerr # Finds the code that returns nil even if it checks that the error is not nil. [fast: false, auto-fix: false] |
| 132 | + - nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value. [fast: false, auto-fix: false] |
| 133 | + - noctx # Finds sending http request without context.Context [fast: false, auto-fix: false] |
| 134 | + - nolintlint # Reports ill-formed or insufficient nolint directives [fast: true, auto-fix: true] |
| 135 | + - nonamedreturns # Reports all named returns [fast: false, auto-fix: false] |
| 136 | + - nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL. [fast: true, auto-fix: false] |
| 137 | + - paralleltest # Detects missing usage of t.Parallel() method in your Go test [fast: false, auto-fix: false] |
| 138 | + - predeclared # find code that shadows one of Go's predeclared identifiers [fast: true, auto-fix: false] |
| 139 | + - promlinter # Check Prometheus metrics naming via promlint [fast: true, auto-fix: false] |
| 140 | + - reassign # Checks that package variables are not reassigned [fast: false, auto-fix: false] |
| 141 | + - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. [fast: false, auto-fix: false] |
| 142 | + - rowserrcheck # checks whether Rows.Err of rows is checked successfully [fast: false, auto-fix: false] |
| 143 | + - spancheck # Checks for mistakes with OpenTelemetry/Census spans. [fast: false, auto-fix: false] |
| 144 | + - sqlclosecheck # Checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed. [fast: false, auto-fix: false] |
| 145 | + - stylecheck # Stylecheck is a replacement for golint [fast: false, auto-fix: false] |
| 146 | + - tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 [fast: false, auto-fix: false] |
| 147 | + - testableexamples # linter checks if examples are testable (have an expected output) [fast: true, auto-fix: false] |
| 148 | + - testifylint # Checks usage of github.com/stretchr/testify. [fast: false, auto-fix: false] |
| 149 | + - testpackage # linter that makes you use a separate _test package [fast: true, auto-fix: false] |
| 150 | + - thelper # thelper detects tests helpers which is not start with t.Helper() method. [fast: false, auto-fix: false] |
| 151 | + - tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes. [fast: false, auto-fix: false] |
| 152 | + - unconvert # Remove unnecessary type conversions [fast: false, auto-fix: false] |
| 153 | + - usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library. [fast: true, auto-fix: false] |
| 154 | + - wastedassign # Finds wasted assignment statements [fast: false, auto-fix: false] |
| 155 | + - whitespace # Whitespace is a linter that checks for unnecessary newlines at the start and end of functions, if, for, etc. [fast: true, auto-fix: true] |
| 156 | + - canonicalheader # Checks whether net/http.Header uses canonical header [fast: false, auto-fix: false] |
| 157 | + - fatcontext #Detects nested contexts in loops [fast: false, auto-fix: false] |
| 158 | + |
| 159 | + ## Don't enable |
| 160 | + #- cyclop # checks function and package cyclomatic complexity [fast: false, auto-fix: false] |
| 161 | + #- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false] |
| 162 | + #- dupl # Tool for code clone detection [fast: true, auto-fix: false] |
| 163 | + #- dupword # checks for duplicate words in the source code [fast: true, auto-fix: false] |
| 164 | + #- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false] |
| 165 | + #- err113 # Go linter to check the errors handling expressions [fast: false, auto-fix: false] |
| 166 | + #- exhaustruct # Checks if all structure fields are initialized [fast: false, auto-fix: false] |
| 167 | + #- gci # Gci controls Go package import order and makes it always deterministic. [fast: true, auto-fix: true] |
| 168 | + #- gochecknoglobals # Check that no global variables exist. [fast: false, auto-fix: false] |
| 169 | + #- gochecknoinits # Checks that no init functions are present in Go code [fast: true, auto-fix: false] |
| 170 | + #- gocyclo # Computes and checks the cyclomatic complexity of functions [fast: true, auto-fix: false] |
| 171 | + #- godot # Check if comments end in a period [fast: true, auto-fix: true] |
| 172 | + #- godox # Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false] |
| 173 | + #- gofumpt # Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true] |
| 174 | + #- funlen # Tool for detection of long functions [fast: true, auto-fix: false] |
| 175 | + #- ginkgolinter # enforces standards of using ginkgo and gomega [fast: false, auto-fix: false] |
| 176 | + #- gocognit # Computes and checks the cognitive complexity of functions [fast: true, auto-fix: false] |
| 177 | + #- interfacebloat # A linter that checks the number of methods inside an interface. [fast: true, auto-fix: false] |
| 178 | + #- lll # Reports long lines [fast: true, auto-fix: false] |
| 179 | + #- ireturn # Accept Interfaces, Return Concrete Types [fast: false, auto-fix: false] |
| 180 | + #- maintidx # maintidx measures the maintainability index of each function. [fast: true, auto-fix: false] |
| 181 | + #- nestif # Reports deeply nested if statements [fast: true, auto-fix: false] |
| 182 | + #- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity [fast: true, auto-fix: false] |
| 183 | + #- perfsprint # Checks that fmt.Sprintf can be replaced with a faster alternative. [fast: false, auto-fix: false] |
| 184 | + #- prealloc # Finds slice declarations that could potentially be pre-allocated [fast: true, auto-fix: false] |
| 185 | + #- protogetter # Reports direct reads from proto message fields when getters should be used [fast: false, auto-fix: true] |
| 186 | + #- sloglint # ensure consistent code style when using log/slog [fast: false, auto-fix: false] |
| 187 | + #- tagalign # check that struct tags are well aligned [fast: true, auto-fix: true] |
| 188 | + #- tagliatelle # Checks the struct tags. [fast: true, auto-fix: false] |
| 189 | + #- unparam # Reports unused function parameters [fast: false, auto-fix: false] |
| 190 | + #- varnamelen # checks that the length of a variable's name matches its scope [fast: false, auto-fix: false] |
| 191 | + #- wrapcheck # Checks that errors returned from external packages are wrapped [fast: false, auto-fix: false] |
| 192 | + #- wsl # add or remove empty lines [fast: true, auto-fix: false] |
| 193 | + #- zerologlint # Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg` [fast: false, auto-fix: false] |
0 commit comments