Skip to content

Commit 70156aa

Browse files
authored
feat(pack): add golangci-lint (#1438)
* feat(pack): add golangci-lint * add go pack
1 parent 51b7bad commit 70156aa

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-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 imports the Go language pack (`astrocommunity.pack.go`) for a complete Go development environment.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---@type LazySpec
2+
return {
3+
{ import = "astrocommunity.pack.go" },
4+
{
5+
"AstroNvim/astrolsp",
6+
---@type AstroLSPOpts
7+
opts = {
8+
---@diagnostic disable: missing-fields
9+
config = {
10+
-- Overrides the default config to support golangci-lint v2
11+
golangci_lint_ls = {
12+
init_options = {
13+
command = {
14+
"golangci-lint",
15+
"run",
16+
"--output.json.path",
17+
"stdout",
18+
"--show-stats=false",
19+
"--issues-exit-code=1",
20+
},
21+
},
22+
},
23+
},
24+
},
25+
},
26+
{
27+
"WhoIsSethDaniel/mason-tool-installer.nvim",
28+
optional = true,
29+
opts = function(_, opts)
30+
opts.ensure_installed =
31+
require("astrocore").list_insert_unique(opts.ensure_installed, { "golangci-lint-langserver" })
32+
end,
33+
},
34+
}

0 commit comments

Comments
 (0)