⚙️ config(nvim): add golingcilint to gomod and gowork files

This commit is contained in:
Sergio Laín 2024-01-09 00:01:45 +01:00
parent 33bc49e9ad
commit 3528240cf7
No known key found for this signature in database
GPG key ID: 14C9B8080681777B

View file

@ -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,
}, },