Skip to content

Commit c9148bf

Browse files
committed
feat(pack): add golangci-lint
1 parent 4296d2f commit c9148bf

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# golangci-lint
2+
3+
Fast linters runner for Go.
4+
5+
This plugin pack integrates [golangci-lint](https://golangci-lint.run/) into your AstroNvim setup using the [golangci-lint-langserver](https://github.com/nametake/golangci-lint-langserver).
6+
7+
**Features:**
8+
9+
- Supports a wide range of linters to catch common errors and improve code quality.
10+
- Automatically installs `golangci-lint-langserver` via Mason.
11+
- Provides lint diagnostics directly in your editor using `golangci-lint`.
12+
- Runs `golangci-lint` efficiently in the background.
13+
14+
**Note:** This pack works best when combined with the Go language pack (`astrocommunity.pack.go`) for a complete Go development environment.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---@type LazySpec
2+
return {
3+
{
4+
"AstroNvim/astrolsp",
5+
---@type AstroLSPOpts
6+
opts = {
7+
---@diagnostic disable: missing-fields
8+
config = {
9+
-- Overrides the default config to support golangci-lint v2
10+
golangci_lint_ls = {
11+
init_options = {
12+
command = {
13+
"golangci-lint",
14+
"run",
15+
"--output.json.path",
16+
"stdout",
17+
"--show-stats=false",
18+
"--issues-exit-code=1",
19+
},
20+
},
21+
},
22+
},
23+
},
24+
},
25+
{
26+
"WhoIsSethDaniel/mason-tool-installer.nvim",
27+
optional = true,
28+
opts = function(_, opts)
29+
opts.ensure_installed =
30+
require("astrocore").list_insert_unique(opts.ensure_installed, { "golangci-lint-langserver" })
31+
end,
32+
},
33+
}

0 commit comments

Comments
 (0)