-
Notifications
You must be signed in to change notification settings - Fork 30
Description
For work, I have a setup where my golangci-lint config resides in it's own centralized repo. When using version 1 of golangci-lint, I set my nvim config to load the config by using the '--config' parameter and supplying the path to the file and that was all working fine. We've recently updated to version 2 of golangci-lint and I've been trying to update my configuration to work with this, but have stumbled across the following problem.
This is what I have configuration wise (I'm using lazy):
lspconfig.golangci_lint_ls.setup({
capabilities = capabilities,
root_dir = lspconfig.util.root_pattern(".git", "go.mod"),
init_options = {
command = {
"golangci-lint",
"run",
"--config",
<path-to-my-config>,
"--output.json.path=stdout",
"--show-stats=false",
"--issues-exit-code=1",
},
},
})
I'm happy that the configuration is loaded OK, because if I introduce typos into the config path, or rename the file, I get a diagnostic advising that the config cannot be loaded. I'm loading an example project that I have with known linting issues to ensure I'm receiving the expected feedback, e.g. The same as I get when running golangci-lint directly via the command line using the same arguments as above. However I receive no diagnostics at all. When I enable debug logging and check LspLog, I can see that I am getting a response from the server, but the returned diagnostics field is empty e.g. diagnostics = {}.
The only way I've been able to get it to work, is to copy my .golangci.yml file into the root of my test project and then comment out the config argument in the above configuration.
I also tried moving the .golangci.yml file from the test project and put it in my user directory, with the config argument above still commented out, so that golangci-lint would hunt for the config itself. It found the config (confirmed again by renaming the file and seeing a diagnostic when it couldn't be found), but again produced an empty set of diagnostics.
I'm running:
golangci-lint v2.1.2
golangci-lint-langserver v0.0.11