|
| 1 | +linters: |
| 2 | + enable: |
| 3 | + # Some of the linters below are commented out. We should uncomment and start running them, but they return |
| 4 | + # too many problems to fix in one commit. Something for later. |
| 5 | + - asasalint # Check for pass []any as any in variadic func(...any). |
| 6 | + - asciicheck # Checks that all code identifiers does not have non-ASCII symbols in the name. |
| 7 | + - bidichk # Checks for dangerous unicode character sequences. |
| 8 | + - bodyclose # Checks whether HTTP response body is closed successfully. |
| 9 | + - decorder # Check declaration order and count of types, constants, variables and functions. |
| 10 | + - dogsled # Checks assignments with too many blank identifiers (e.g. x, , , _, := f()). |
| 11 | + - dupl # Tool for code clone detection. |
| 12 | + - dupword # Checks for duplicate words in the source code. |
| 13 | + - durationcheck # Check for two durations multiplied together. |
| 14 | + - errcheck # Errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases. |
| 15 | + - errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error. |
| 16 | + - exhaustive # Check exhaustiveness of enum switch statements. |
| 17 | + - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification. |
| 18 | + - goimports # Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode. |
| 19 | + - gosec # Inspects source code for security problems. |
| 20 | + - gosimple # Linter for Go source code that specializes in simplifying code. |
| 21 | + - govet # Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes. |
| 22 | + - ineffassign # Detects when assignments to existing variables are not used. |
| 23 | + - importas # Enforces consistent import aliases. |
| 24 | + - misspell # Finds commonly misspelled English words. |
| 25 | + - prealloc # Finds slice declarations that could potentially be pre-allocated. |
| 26 | + - promlinter # Check Prometheus metrics naming via promlint. |
| 27 | + - sloglint # Ensure consistent code style when using log/slog. |
| 28 | + - sqlclosecheck # Checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed. |
| 29 | + - staticcheck # It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. |
| 30 | + - tenv # Tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17. |
| 31 | + - testableexamples # Linter checks if examples are testable (have an expected output). |
| 32 | + - testifylint # Checks usage of github.com/stretchr/testify. |
| 33 | + - tparallel # Tparallel detects inappropriate usage of t.Parallel() method in your Go test codes. |
| 34 | + - unconvert # Remove unnecessary type conversions. |
| 35 | + - unused # Checks Go code for unused constants, variables, functions and types. |
| 36 | + - wastedassign # Finds wasted assignment statements. |
| 37 | + - whitespace # Whitespace is a linter that checks for unnecessary newlines at the start and end of functions, if, for, etc. |
| 38 | + - zerologlint # Detects the wrong usage of zerolog that a user forgets to dispatch with Send or Msg. |
| 39 | + # Other linters are disabled, list of all is here: https://golangci-lint.run/usage/linters/ |
| 40 | +run: |
| 41 | + timeout: 5m |
| 42 | + modules-download-mode: vendor |
| 43 | + |
| 44 | +# output configuration options |
| 45 | +output: |
| 46 | + formats: |
| 47 | + - format: 'colored-line-number' |
| 48 | + print-issued-lines: true |
| 49 | + print-linter-name: true |
| 50 | + |
| 51 | +issues: |
| 52 | + # Maximum issues count per one linter. |
| 53 | + # Set to 0 to disable. |
| 54 | + # Default: 50 |
| 55 | + max-issues-per-linter: 50 |
| 56 | + # Maximum count of issues with the same text. |
| 57 | + # Set to 0 to disable. |
| 58 | + # Default: 3 |
| 59 | + max-same-issues: 15 |
| 60 | + # Show only new issues: if there are unstaged changes or untracked files, |
| 61 | + # only those changes are analyzed, else only changes in HEAD~ are analyzed. |
| 62 | + # It's a super-useful option for integration of golangci-lint into existing large codebase. |
| 63 | + # It's not practical to fix all existing issues at the moment of integration: |
| 64 | + # much better don't allow issues in new code. |
| 65 | + # |
| 66 | + # Default: false |
| 67 | + new: true |
| 68 | + # Show only new issues created after git revision `REV`. |
| 69 | + # Default: "" |
| 70 | + new-from-rev: ac34f94d423273c8fa8fdbb5f2ac60e55f2c77d5 |
| 71 | + # Show issues in any part of update files (requires new-from-rev or new-from-patch). |
| 72 | + # Default: false |
| 73 | + whole-files: true |
| 74 | + # Which dirs to exclude: issues from them won't be reported. |
| 75 | + # Can use regexp here: `generated.*`, regexp is applied on full path, |
| 76 | + # including the path prefix if one is set. |
| 77 | + # Default dirs are skipped independently of this option's value (see exclude-dirs-use-default). |
| 78 | + # "/" will be replaced by current OS file path separator to properly work on Windows. |
| 79 | + # Default: [] |
| 80 | + exclude-dirs: |
| 81 | + - vendor |
| 82 | + |
| 83 | +linters-settings: |
| 84 | + # Check exhaustiveness of enum switch statements. |
| 85 | + exhaustive: |
| 86 | + # Presence of "default" case in switch statements satisfies exhaustiveness, |
| 87 | + # even if all enum members are not listed. |
| 88 | + # Default: false |
| 89 | + default-signifies-exhaustive: true |
0 commit comments