nametake / golangci-lint-langserver

golangci-lint language server
MIT License
201 stars 19 forks source link

Unexpected end of JSON input error #17

Open leoluz opened 2 years ago

leoluz commented 2 years ago

I can't seem to get it working in my setup.

Im getting the following error from lsp logs in Neovim:

[ERROR][2021-12-08 15:04:28] .../vim/lsp/rpc.lua:417 "rpc" "golangci-lint-langserver" "stderr" "unexpected end of JSON input\n"

My configs:

Neovim: 0.6.0 golangci-lint-langserver: v0.0.6 running with lspconfig with standard config:

if not configs.golangcilsp then
  configs.golangcilsp = {
    default_config = {
      cmd = {"golangci-lint-langserver", "-debug", "true"},
      root_dir = lspconfig.util.root_pattern('.git', 'go.mod'),
      init_options = {
        command = { "golangci-lint", "run", "--enable-all", "--disable", "lll", "--out-format", "json" };
      }
    };
  }
end

lspconfig.golangcilsp.setup {
  filetypes = {'go'}
}
nametake commented 2 years ago

That log was output as golangci-lint command not found.

Please install golangci-lint.

And I appended it to the README.

Thank you!

leoluz commented 2 years ago

I do have golangci-lint installed and it is part of my PATH:

$golangci-lint --version
golangci-lint has version 1.43.0 built from 861262b on 2021-11-02T20:54:42Z
nametake commented 2 years ago

Maybe it is caused by the lock of parallel execution.

https://github.com/golangci/golangci-lint/blob/d29d9f12395a9928a1b50e9c00f7c56db39bf655/pkg/commands/executor.go#L220-L221

If exist lock file, please delete it.

Or, please try to add --allow-parallel-runners to golangci-lint option.