dotfiles/.config/nvim/lua/plugins/extras/linting/golangci.lua
2024-01-09 00:01:45 +01:00

33 lines
934 B
Lua

return {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "golangcil-lint" })
end,
},
{
"mfussenegger/nvim-lint",
opts = function(_, opts)
--- Extend the conform plugin config and add given formatters
---@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
end,
},
}