Skip to content

Commit c028d1b

Browse files
committed
set up gopls and basic go formatting
1 parent 4ba3af1 commit c028d1b

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

after/ftplugin/go.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- gofumpt adds more rule to gofmt, and is compatible with gofmt,
2+
-- so also https://github.com/mvdan/gofumpt
3+
vim.keymap.set("n", "<Space>f", function()
4+
vim.cmd([[silent !gofumpt -w %]])
5+
end, { buffer = true, silent = true })

after/lsp/gopls.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-- settings for gopls can be found in https://go.dev/gopls/settings
2+
---@type vim.lsp.Config
3+
return {
4+
settings = {
5+
gopls = {
6+
usePlaceholders = true,
7+
analyses = {
8+
unusedparams = true,
9+
},
10+
staticcheck = true,
11+
gofumpt = true,
12+
},
13+
},
14+
}

0 commit comments

Comments
 (0)