From 2e167f0bd1462449e41dcd568f9764cca4519c31 Mon Sep 17 00:00:00 2001 From: Axel Meyer Date: Wed, 4 Mar 2026 01:09:18 +0100 Subject: [PATCH] Fix golangci-lint v2 config: use linters.exclusions format v2 moved issues.exclude-rules to linters.exclusions.rules and issues.exclude-dirs to linters.exclusions.paths. Enable the std-error-handling preset for defer Close() patterns. Co-Authored-By: Claude Opus 4.6 --- .golangci.yml | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index f60a998..07e2f80 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,26 +8,21 @@ linters: - ineffassign - staticcheck - unused - -issues: - exclude-dirs: - - cmd/panel - - cmd/icongen - exclude-rules: - # defer body.Close() — safe pattern, return value is irrelevant - - linters: [errcheck] - source: "defer .+\\.Close\\(\\)" - # resp.Body.Close in non-defer context (checked via HTTP status already) - - linters: [errcheck] - source: "\\.Body\\.Close\\(\\)" - # systray menu.ShowMenu has no meaningful error - - linters: [errcheck] - path: internal/tray/ - source: "ShowMenu" - # binary.Write in ICO header encoding — panic-level errors only - - linters: [errcheck] - path: internal/icons/render\.go - source: "binary\\.Write" - # Setup binary is a CLI wizard; best-effort error handling is acceptable - - linters: [errcheck, gosec] - path: cmd/setup/ + exclusions: + presets: + - std-error-handling + rules: + # binary.Write in ICO header encoding — panic-level errors only + - path: internal/icons/render\.go + linters: [errcheck] + source: "binary\\.Write" + # systray menu.ShowMenu has no meaningful error + - path: internal/tray/ + linters: [errcheck] + source: "ShowMenu" + # Setup binary is a CLI wizard; best-effort error handling is acceptable + - path: cmd/setup/ + linters: [errcheck, gosec] + paths: + - cmd/panel + - cmd/icongen