diff --git a/.vscode/settings.json b/.vscode/settings.json index dd4398af9..fb3f4ac2b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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", } diff --git a/scripts/gofumpt-tool.sh b/scripts/gofumpt-tool.sh new file mode 100755 index 000000000..f9aae65a7 --- /dev/null +++ b/scripts/gofumpt-tool.sh @@ -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 "$@"