Open RonanMacF opened 1 year ago
You can write { "gopls.analyses.nilness": true} in your json file.
I was also totally confused by that, but, alas, there's a better way :) Do this instead:
{
"gopls": {
"ui.diagnostic.analyses": {
"fieldalignment": true,
"nilness": true,
"unusedparams": true,
"unusedwrite": true
}
}
}
Now you get all the suggestions from the schema too and it translates 1:1 with the official spec: https://github.com/golang/tools/blob/master/gopls/doc/settings.md
Just as a gotcha for anyone else stumbling into my problem, which maybe were your original issue as well:
LspInstall
will happily create a file for any string. So I created a go.json
config file. Now this won't work, you need to create a gopls.json
file (LspInstall gopls
). If you do this, you'll also get automatic code-completions.
So keep in mind you're configuring the lsp, not the language preconfigured lsp.
It's not clear how the JSON is supposed to be setup here, for example I have tried
Also tried the above with an outer
gopls
and against with an outersettings
but it does not get applied to the gopls server, when I manually do the settings, for example as below, I see the linting appear.