feats: golang linting for nvim

This commit is contained in:
Klesh Wong 2022-09-11 13:11:36 +08:00
parent 9418d06cdb
commit c35040650c

View File

@ -146,3 +146,21 @@ end
-- },
-- })
-- end
-- golangci
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", "--out-format", "json",
"--issues-exit-code=1" };
}
};
}
end
lspconfig.golangci_lint_ls.setup {
filetypes = { 'go', 'gomod' }
}