From 7f02210863692ac1a5692d019125a02c82860b9a Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Mon, 18 May 2026 18:26:01 +0000 Subject: [PATCH] .golangci: ignore tests for goconst, raise occurrence threshold Test fixtures repeat strings (IPs, tags, hostnames, user/email names) by their nature; extracting each into a named constant adds indirection without adding clarity. Keep goconst strict on production code, off on tests. ignore-tests: true drop test-fixture noise entirely min-occurrences: 5 raise from default 3 to filter "happens thrice" non-vocabulary cases min-len: 6 skip short literals like "set", "get", "new" that read better at call sites --- .golangci.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.golangci.yaml b/.golangci.yaml index c6d8ff01..ed6630da 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -30,6 +30,17 @@ linters: - wrapcheck - wsl settings: + goconst: + # Test fixtures repeat strings (IPs, tags, hostnames) by their + # nature; extracting them obscures the test rather than helping. + # Production code stays strict. + ignore-tests: true + # Default is 3. Bump so "happens thrice" cases that are not part + # of a shared vocabulary do not get extracted. + min-occurrences: 5 + # Default is 3. Short literals ("set", "get", "new") read better + # at call sites than behind a named constant. + min-len: 6 forbidigo: forbid: # Forbid time.Sleep everywhere with context-appropriate alternatives