Add gofumpt-tool.sh script and use it in VS Code

This commit is contained in:
Stefan Haller
2026-07-02 10:41:23 +02:00
parent 2d4a4dcdc1
commit 9882e4a03e
2 changed files with 15 additions and 1 deletions
+3 -1
View File
@@ -1,6 +1,6 @@
{
"gopls": {
"formatting.gofumpt": true,
"formatting.gofumpt": false,
"ui.diagnostic.staticcheck": true,
"ui.diagnostic.analyses": {
// This list must match the one in .golangci.yml
@@ -24,6 +24,8 @@
},
"go.alternateTools": {
"golangci-lint-v2": "${workspaceFolder}/scripts/golangci-lint-shim.sh",
"customFormatter": "${workspaceFolder}/scripts/gofumpt-tool.sh",
},
"go.lintTool": "golangci-lint-v2",
"go.formatTool": "custom",
}
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
# This is used by VSCode; it is not very useful otherwise, since it's easy
# enough to just run `go tool gofumpt` directly, or use `just format`.
set -e
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
repo_root=$(dirname "$script_dir")
cd "$repo_root"
exec go tool gofumpt "$@"