From d9e299c1dfb654caee04d59091489262dcd431aa Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 30 Jun 2025 10:12:18 +0200 Subject: [PATCH] Update VS Code settings to enable staticcheck linter ... and configure it to run the same checks as golangci-lint. It may seem redundant to have two linter checks enabled; however, there are reasons to have both. golangci-lint is what we are running on CI, and it has a lot more linters than gopls, so we want to run it locally too to get the same coverage. The linter that is built into gopls is only staticcheck, so that's redundant; but it has the advantage that the warnings appear a bit faster (golangci-lint runs only on save, and with a bit of delay), and in particular it provides quick fixes for some of the checks, which is quite convenient. --- .vscode/settings.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index f1a17a3c9..23a0e524b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,26 @@ { "gopls": { "formatting.gofumpt": true, + "ui.diagnostic.staticcheck": true, + "ui.diagnostic.analyses": { + // This list must match the one in .golangci.yml + "SA1019": false, + "ST1003": false, + "ST1005": false, + "ST1006": false, + "QF1001": false, + "QF1003": false, + "QF1008": false, + "ST1000": false, + "ST1020": false, + "ST1021": false, + "ST1022": false, + // Dot imports; this warning is enabled in .golangci.yml, but with an + // extra dot-import-whitelist config. Because I couldn't figure out how to + // specify that extra config for gopls, I'm disabling the check altogether + // here. + "ST1001": false, + }, }, "go.alternateTools": { "golangci-lint-v2": "${workspaceFolder}/.bin/golangci-lint",