Skip to content

Commit d9e299c

Browse files
committed
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.
1 parent 9b54dc0 commit d9e299c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.vscode/settings.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
{
22
"gopls": {
33
"formatting.gofumpt": true,
4+
"ui.diagnostic.staticcheck": true,
5+
"ui.diagnostic.analyses": {
6+
// This list must match the one in .golangci.yml
7+
"SA1019": false,
8+
"ST1003": false,
9+
"ST1005": false,
10+
"ST1006": false,
11+
"QF1001": false,
12+
"QF1003": false,
13+
"QF1008": false,
14+
"ST1000": false,
15+
"ST1020": false,
16+
"ST1021": false,
17+
"ST1022": false,
18+
// Dot imports; this warning is enabled in .golangci.yml, but with an
19+
// extra dot-import-whitelist config. Because I couldn't figure out how to
20+
// specify that extra config for gopls, I'm disabling the check altogether
21+
// here.
22+
"ST1001": false,
23+
},
424
},
525
"go.alternateTools": {
626
"golangci-lint-v2": "${workspaceFolder}/.bin/golangci-lint",

0 commit comments

Comments
 (0)