| Abhay Kumar | a61c522 | 2025-11-10 07:32:50 +0000 | [diff] [blame] | 1 | output: |
| 2 | # Make output more digestible with quickfix in vim/emacs/etc. |
| 3 | sort-results: true |
| 4 | print-issued-lines: false |
| 5 | |
| 6 | linters: |
| 7 | # We'll track the golangci-lint default linters manually |
| 8 | # instead of letting them change without our control. |
| 9 | disable-all: true |
| 10 | enable: |
| 11 | # golangci-lint defaults: |
| 12 | - errcheck |
| 13 | - gosimple |
| 14 | - govet |
| 15 | - ineffassign |
| 16 | - staticcheck |
| 17 | - unused |
| 18 | |
| 19 | # Our own extras: |
| 20 | - gofumpt |
| 21 | - nolintlint # lints nolint directives |
| 22 | - revive |
| 23 | |
| 24 | linters-settings: |
| 25 | govet: |
| 26 | # These govet checks are disabled by default, but they're useful. |
| 27 | enable: |
| 28 | - niliness |
| 29 | - reflectvaluecompare |
| 30 | - sortslice |
| 31 | - unusedwrite |
| 32 | |
| 33 | errcheck: |
| 34 | exclude-functions: |
| 35 | # These methods can not fail. |
| 36 | # They operate on an in-memory buffer. |
| 37 | - (*go.uber.org/zap/buffer.Buffer).Write |
| 38 | - (*go.uber.org/zap/buffer.Buffer).WriteByte |
| 39 | - (*go.uber.org/zap/buffer.Buffer).WriteString |
| 40 | |
| 41 | - (*go.uber.org/zap/zapio.Writer).Close |
| 42 | - (*go.uber.org/zap/zapio.Writer).Sync |
| 43 | - (*go.uber.org/zap/zapio.Writer).Write |
| 44 | # Write to zapio.Writer cannot fail, |
| 45 | # so io.WriteString on it cannot fail. |
| 46 | - io.WriteString(*go.uber.org/zap/zapio.Writer) |
| 47 | |
| 48 | # Writing a plain string to a fmt.State cannot fail. |
| 49 | - io.WriteString(fmt.State) |
| 50 | |
| 51 | issues: |
| 52 | # Print all issues reported by all linters. |
| 53 | max-issues-per-linter: 0 |
| 54 | max-same-issues: 0 |
| 55 | |
| 56 | # Don't ignore some of the issues that golangci-lint considers okay. |
| 57 | # This includes documenting all exported entities. |
| 58 | exclude-use-default: false |
| 59 | |
| 60 | exclude-rules: |
| 61 | # Don't warn on unused parameters. |
| 62 | # Parameter names are useful; replacing them with '_' is undesirable. |
| 63 | - linters: [revive] |
| 64 | text: 'unused-parameter: parameter \S+ seems to be unused, consider removing or renaming it as _' |
| 65 | |
| 66 | # staticcheck already has smarter checks for empty blocks. |
| 67 | # revive's empty-block linter has false positives. |
| 68 | # For example, as of writing this, the following is not allowed. |
| 69 | # for foo() { } |
| 70 | - linters: [revive] |
| 71 | text: 'empty-block: this block is empty, you can remove it' |
| 72 | |
| 73 | # Ignore logger.Sync() errcheck failures in example_test.go |
| 74 | # since those are intended to be uncomplicated examples. |
| 75 | - linters: [errcheck] |
| 76 | path: example_test.go |
| 77 | text: 'Error return value of `logger.Sync` is not checked' |