⚙️ config(nvim): add golingcilint to gomod and gowork files
This commit is contained in:
parent
33bc49e9ad
commit
3528240cf7
1 changed files with 18 additions and 2 deletions
|
@ -9,8 +9,24 @@ return {
|
||||||
{
|
{
|
||||||
"mfussenegger/nvim-lint",
|
"mfussenegger/nvim-lint",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
opts.linters_by_ft.go = opts.linters_by_ft.go or {}
|
--- Extend the conform plugin config and add given formatters
|
||||||
table.insert(opts.linters_by_ft.go, "golangcilint")
|
---@param tbl table<string, conform.FormatterUnit[]> Table of filetype to formatters mappings
|
||||||
|
local function add_formatters(tbl)
|
||||||
|
for ft, formatters in pairs(tbl) do
|
||||||
|
if opts.formatters_by_ft[ft] == nil then
|
||||||
|
opts.formatters_by_ft[ft] = formatters
|
||||||
|
else
|
||||||
|
vim.list_extend(opts.formatters_by_ft[ft], formatters)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
add_formatters({
|
||||||
|
["go"] = { "golangcilint" },
|
||||||
|
["gomod"] = { "golangcilint" },
|
||||||
|
["gowork"] = { "golangcilint" },
|
||||||
|
})
|
||||||
|
|
||||||
return opts
|
return opts
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue