From 672ff7f44b0061e179fb33c16418738d6455a4e9 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Wed, 15 Jul 2026 02:23:40 -0500 Subject: 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. --- .golangci.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..32883a8 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,48 @@ +version: "2" + +linters: + # standard = govet, errcheck, staticcheck, ineffassign, unused + default: standard + enable: + # Correctness / security + - bodyclose + - noctx + - gosec + - forcetypeassert + - canonicalheader + - musttag + - predeclared + - exhaustive + # Modernization + - modernize + - gocritic + - mirror + - perfsprint + - intrange + # Docs and style + - revive + - godot + + settings: + revive: + rules: + # Requires a doc comment on every exported symbol, starting with the + # symbol's own name. checkPrivateReceivers extends this to exported + # methods on unexported types, which is most of the app package. + - name: exported + arguments: + - checkPrivateReceivers + staticcheck: + # "all" turns on the doc-comment checks (ST1000/ST1020/ST1021/ST1022) and + # the naming checks (ST1003), which are off by default. + checks: + - all + + exclusions: + rules: + # Test helpers make throwaway requests to a local httptest server; a + # context and a closed body add noise without catching anything. + - path: _test\.go$ + linters: + - bodyclose + - noctx -- cgit v1.2.3