Use golangci-lint with your lsp in neovim

Install golangci-lint and the golangci-lint languageserver

In your terminal. Install golangci-lint and golangci-lint-langserver

	go install
	go install

Setup your Neovim config

I use go-vim and nvim-lspconfig


let g:go_metalinter_command = "golangci-lint"

  local configs = require 'lspconfig/configs'
  if not configs.golangcilsp then
    configs.golangcilsp = {
      default_config = {
        cmd = {'golangci-lint-langserver'},
        root_dir = lspconfig.util.root_pattern('.git', 'go.mod'),
        init_options = {
          command = { "golangci-lint", "run", "--fast", "--disable", "lll", "--out-format", "json", "--issues-exit-code=1" };

  lspconfig.golangci_lint_ls.setup {
    filetypes = {'go','gomod'}

Now when you open a golang file, nvim-lspconfig will dispatch to golangci-lint-langserver for linting rules. By default, it will look for your projects .golangci.toml for linting configuration.