|
| 1 | +version: "2" |
| 2 | +# Configuration for how we run golangci-lint |
| 3 | +# Timeout of 5m was the default in v1. |
| 4 | +run: |
| 5 | + timeout: 5m |
1 | 6 | linters: |
2 | 7 | # Don't enable any linters by default; just the ones that we explicitly |
3 | 8 | # enable in the list below. |
4 | | - disable-all: true |
| 9 | + default: none |
5 | 10 | enable: |
6 | 11 | - bidichk |
7 | | - - gofmt |
8 | | - - goimports |
9 | 12 | - govet |
10 | 13 | - misspell |
11 | 14 | - revive |
12 | | - |
13 | | -# Configuration for how we run golangci-lint |
14 | | -run: |
15 | | - timeout: 5m |
16 | | - |
17 | | -issues: |
18 | | - # Excluding configuration per-path, per-linter, per-text and per-source |
19 | | - exclude-rules: |
20 | | - # These are forks of an upstream package and thus are exempt from stylistic |
21 | | - # changes that would make pulling in upstream changes harder. |
22 | | - - path: tempfork/.*\.go |
23 | | - text: "File is not `gofmt`-ed with `-s` `-r 'interface{} -> any'`" |
24 | | - - path: util/singleflight/.*\.go |
25 | | - text: "File is not `gofmt`-ed with `-s` `-r 'interface{} -> any'`" |
26 | | - |
27 | | -# Per-linter settings are contained in this top-level key |
28 | | -linters-settings: |
29 | | - gofmt: |
30 | | - rewrite-rules: |
31 | | - - pattern: 'interface{}' |
32 | | - replacement: 'any' |
33 | | - |
34 | | - govet: |
| 15 | + settings: |
35 | 16 | # Matches what we use in corp as of 2023-12-07 |
36 | | - enable: |
37 | | - - asmdecl |
38 | | - - assign |
39 | | - - atomic |
40 | | - - bools |
41 | | - - buildtag |
42 | | - - cgocall |
43 | | - - copylocks |
44 | | - - deepequalerrors |
45 | | - - errorsas |
46 | | - - framepointer |
47 | | - - httpresponse |
48 | | - - ifaceassert |
49 | | - - loopclosure |
50 | | - - lostcancel |
51 | | - - nilfunc |
52 | | - - nilness |
53 | | - - printf |
54 | | - - reflectvaluecompare |
55 | | - - shift |
56 | | - - sigchanyzer |
57 | | - - sortslice |
58 | | - - stdmethods |
59 | | - - stringintconv |
60 | | - - structtag |
61 | | - - testinggoroutine |
62 | | - - tests |
63 | | - - unmarshal |
64 | | - - unreachable |
65 | | - - unsafeptr |
66 | | - - unusedresult |
67 | | - settings: |
68 | | - printf: |
69 | | - # List of print function names to check (in addition to default) |
70 | | - funcs: |
71 | | - - github.com/tailscale/tailscale/types/logger.Discard |
72 | | - # NOTE(andrew-d): this doesn't currently work because the printf |
73 | | - # analyzer doesn't support type declarations |
74 | | - #- github.com/tailscale/tailscale/types/logger.Logf |
75 | | - |
76 | | - revive: |
77 | | - enable-all-rules: false |
78 | | - ignore-generated-header: true |
| 17 | + govet: |
| 18 | + enable: |
| 19 | + - asmdecl |
| 20 | + - assign |
| 21 | + - atomic |
| 22 | + - bools |
| 23 | + - buildtag |
| 24 | + - cgocall |
| 25 | + - copylocks |
| 26 | + - deepequalerrors |
| 27 | + - errorsas |
| 28 | + - framepointer |
| 29 | + - httpresponse |
| 30 | + - ifaceassert |
| 31 | + - loopclosure |
| 32 | + - lostcancel |
| 33 | + - nilfunc |
| 34 | + - nilness |
| 35 | + - printf |
| 36 | + - reflectvaluecompare |
| 37 | + - shift |
| 38 | + - sigchanyzer |
| 39 | + - sortslice |
| 40 | + - stdmethods |
| 41 | + - stringintconv |
| 42 | + - structtag |
| 43 | + - testinggoroutine |
| 44 | + - tests |
| 45 | + - unmarshal |
| 46 | + - unreachable |
| 47 | + - unsafeptr |
| 48 | + - unusedresult |
| 49 | + settings: |
| 50 | + printf: |
| 51 | + # List of print function names to check (in addition to default) |
| 52 | + funcs: |
| 53 | + - github.com/tailscale/tailscale/types/logger.Discard |
| 54 | + # NOTE(andrew-d): this doesn't currently work because the printf |
| 55 | + # analyzer doesn't support type declarations |
| 56 | + #- github.com/tailscale/tailscale/types/logger.Logf |
| 57 | + revive: |
| 58 | + enable-all-rules: false |
| 59 | + rules: |
| 60 | + - name: atomic |
| 61 | + - name: context-keys-type |
| 62 | + - name: defer |
| 63 | + arguments: [[ |
| 64 | + # Calling 'recover' at the time a defer is registered (i.e. "defer recover()") has no effect. |
| 65 | + "immediate-recover", |
| 66 | + # Calling 'recover' outside of a deferred function has no effect |
| 67 | + "recover", |
| 68 | + # Returning values from a deferred function has no effect |
| 69 | + "return", |
| 70 | + ]] |
| 71 | + - name: duplicated-imports |
| 72 | + - name: errorf |
| 73 | + - name: string-of-int |
| 74 | + - name: time-equal |
| 75 | + - name: unconditional-recursion |
| 76 | + - name: useless-break |
| 77 | + - name: waitgroup-by-value |
| 78 | + exclusions: |
| 79 | + generated: lax |
| 80 | + presets: |
| 81 | + - comments |
| 82 | + - common-false-positives |
| 83 | + - legacy |
| 84 | + - std-error-handling |
79 | 85 | rules: |
80 | | - - name: atomic |
81 | | - - name: context-keys-type |
82 | | - - name: defer |
83 | | - arguments: [[ |
84 | | - # Calling 'recover' at the time a defer is registered (i.e. "defer recover()") has no effect. |
85 | | - "immediate-recover", |
86 | | - # Calling 'recover' outside of a deferred function has no effect |
87 | | - "recover", |
88 | | - # Returning values from a deferred function has no effect |
89 | | - "return", |
90 | | - ]] |
91 | | - - name: duplicated-imports |
92 | | - - name: errorf |
93 | | - - name: string-of-int |
94 | | - - name: time-equal |
95 | | - - name: unconditional-recursion |
96 | | - - name: useless-break |
97 | | - - name: waitgroup-by-value |
| 86 | + # These are forks of an upstream package and thus are exempt from stylistic |
| 87 | + # changes that would make pulling in upstream changes harder. |
| 88 | + - path: tempfork/.*\.go |
| 89 | + text: File is not `gofmt`-ed with `-s` `-r 'interface{} -> any'` |
| 90 | + - path: util/singleflight/.*\.go |
| 91 | + text: File is not `gofmt`-ed with `-s` `-r 'interface{} -> any'` |
| 92 | + paths: |
| 93 | + - third_party$ |
| 94 | + - builtin$ |
| 95 | + - examples$ |
| 96 | +formatters: |
| 97 | + enable: |
| 98 | + - gofmt |
| 99 | + - goimports |
| 100 | + settings: |
| 101 | + gofmt: |
| 102 | + rewrite-rules: |
| 103 | + - pattern: interface{} |
| 104 | + replacement: any |
| 105 | + exclusions: |
| 106 | + generated: lax |
| 107 | + paths: |
| 108 | + - third_party$ |
| 109 | + - builtin$ |
| 110 | + - examples$ |
0 commit comments