-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgo.lua
83 lines (80 loc) · 2.29 KB
/
go.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
local generator = require("plugins.extras.langspec"):new()
---@type LangConfig
local conf = {
ft = "go",
parsers = { -- nvim-treesitter: language parsers
"go",
"gomod",
"gowork",
},
}
if vim.fn.executable("go") == 1 then
conf = vim.tbl_extend("force", conf, {
cmdtools = { -- mason.nvim: cmdline tools for LSP servers, DAP servers, formatters and linters
"gopls",
"goimports",
"gofumpt",
"golangci-lint",
"golangci-lint-langserver", -- Wraps golangci-lint as a language server
"delve",
--"staticcheck",
"gomodifytags",
"impl",
},
lsp = {
servers = { -- nvim-lspconfig: setup lspconfig servers
gopls = {
settings = {
-- https://github.com/golang/tools/blob/master/gopls/doc/settings.md
gopls = {
gofumpt = true, -- formatter, default "goimports"
codelenses = {
gc_details = false,
generate = true,
regenerate_cgo = true,
run_govulncheck = true,
test = true,
tidy = true,
upgrade_dependency = true,
vendor = true,
},
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
analyses = {
fieldalignment = true,
nilness = true,
unusedparams = true,
unusedwrite = true,
useany = true,
},
},
},
},
golangci_lint_ls = {}, -- linter
},
},
code_actions = { -- null-ls.nvim: builtins code_actions
"gomodifytags",
"impl",
},
dap = { -- nvim-dap: language specific extensions
{ "leoluz/nvim-dap-go" },
},
test = { -- neotest: language specific adapters
"nvim-neotest/neotest-go",
adapters = {
["neotest-go"] = {
args = { "-count=1", "-timeout=60s", "-race", "-cover" },
},
},
},
})
end
return generator:generate(conf)