|
| 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 | + - gofmt |
| 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 | +issues: |
| 34 | + # Print all issues reported by all linters. |
| 35 | + max-issues-per-linter: 0 |
| 36 | + max-same-issues: 0 |
| 37 | + |
| 38 | + # Don't ignore some of the issues that golangci-lint considers okay. |
| 39 | + # This includes documenting all exported entities. |
| 40 | + exclude-use-default: false |
| 41 | + |
| 42 | + exclude-rules: |
| 43 | + # Don't warn on unused parameters. |
| 44 | + # Parameter names are useful; replacing them with '_' is undesirable. |
| 45 | + - linters: [revive] |
| 46 | + text: 'unused-parameter: parameter \S+ seems to be unused, consider removing or renaming it as _' |
| 47 | + |
| 48 | + # staticcheck already has smarter checks for empty blocks. |
| 49 | + # revive's empty-block linter has false positives. |
| 50 | + # For example, as of writing this, the following is not allowed. |
| 51 | + # for foo() { } |
| 52 | + - linters: [revive] |
| 53 | + text: 'empty-block: this block is empty, you can remove it' |
| 54 | + |
| 55 | + # We're using a pretty pedantic style for revive. |
| 56 | + # Generated files cannot always comply with it, so omit them. |
| 57 | + - linters: [revive] |
| 58 | + path: '_gen.go$' |
| 59 | + |
| 60 | + # Also opt-out revive for source files used in examples. |
| 61 | + # The contents of those source files affect the documentation, |
| 62 | + # so we want to control their contents. |
| 63 | + - linters: [revive] |
| 64 | + path: 'docs/ex/.*.go$' |
| 65 | + |
| 66 | + # magic_gen has some generated code that writes to fields of a struct |
| 67 | + # that eventually goes unused. |
| 68 | + # This is a false positive -- that struct is intentionally unused. |
| 69 | + - linters: [govet] |
| 70 | + path: examples/magic_gen.go |
| 71 | + text: 'unusedwrite: unused write to field' |
0 commit comments