Commit 672ff7f44b

672ff7f44b0061e179fb33c16418738d6455a4e9

parent: b1ad145532

Verified · cmc

cmc <hello@cleberg.net> · 2026-07-15 07:23 UTC

build: add golangci-lint configuration

Enables the standard linters plus revive's exported rule, a set of
correctness/security linters (bodyclose, noctx, gosec, forcetypeassert,
canonicalheader, musttag, predeclared, exhaustive), modernization
linters, and staticcheck's full check set including the doc-comment and
naming checks that are off by default.

The idiom-fighting linters stay off: varnamelen objects to short names
that are idiomatic Go, exhaustruct demands every field be initialized,
gochecknoglobals flags CFG/Host which are deliberate, and tagliatelle
would rename JSON config keys and break existing instances' configs.

Layout: unified · split

.golangci.yml added +48
@@ -0,0 +1,48 @@
1version: "2"
2
3linters:
4 # standard = govet, errcheck, staticcheck, ineffassign, unused
5 default: standard
6 enable:
7 # Correctness / security
8 - bodyclose
9 - noctx
10 - gosec
11 - forcetypeassert
12 - canonicalheader
13 - musttag
14 - predeclared
15 - exhaustive
16 # Modernization
17 - modernize
18 - gocritic
19 - mirror
20 - perfsprint
21 - intrange
22 # Docs and style
23 - revive
24 - godot
25
26 settings:
27 revive:
28 rules:
29 # Requires a doc comment on every exported symbol, starting with the
30 # symbol's own name. checkPrivateReceivers extends this to exported
31 # methods on unexported types, which is most of the app package.
32 - name: exported
33 arguments:
34 - checkPrivateReceivers
35 staticcheck:
36 # "all" turns on the doc-comment checks (ST1000/ST1020/ST1021/ST1022) and
37 # the naming checks (ST1003), which are off by default.
38 checks:
39 - all
40
41 exclusions:
42 rules:
43 # Test helpers make throwaway requests to a local httptest server; a
44 # context and a closed body add noise without catching anything.
45 - path: _test\.go$
46 linters:
47 - bodyclose
48 - noctx