Skip to content

go.alternativeTools does not override go.formatTool #3861

@vanyauhalin

Description

@vanyauhalin

What version of Go, VS Code & VS Code Go extension are you using?

$ mise version --json | jq -r .version
2025.8.20 macos-arm64 (2025-08-22)

$ go version
go version go1.25.0 darwin/arm64

$ gopls version
golang.org/x/tools/gopls v0.20.0

$ gofumpt --version
v0.9.0+dirty (go1.25.0)

$ code -v
1.103.2
6f17636121051a53c88d3e605c491d22af2ba755
arm64

$ ls ~/.vscode/extensions/ | grep golang.go
golang.go-0.51.0

Describe the bug

This configuration does not work:

{
  "[go]": {
    "editor.defaultFormatter": "golang.go",
    "editor.formatOnSave": true
  },
  "go.alternateTools": {
    "go": "~/.local/share/mise/shims/go",
    "gofumpt": "~/.local/share/mise/shims/gofumpt",
    "gopls": "~/.local/share/mise/shims/gopls"
  },
  "go.formatTool": "gofumpt"
}

This configuration does work:

{
  "[go]": {
    "editor.defaultFormatter": "golang.go",
    "editor.formatOnSave": true
  },
  "go.alternateTools": {
    "customFormatter": "~/.local/share/mise/shims/gofumpt",
    "go": "~/.local/share/mise/shims/go",
    "gopls": "~/.local/share/mise/shims/gopls"
  },
  "go.formatTool": "custom"
}

I expect the go.alternativeTools to override any tool that the extension uses, including go.formatTool.

Relative

#3732 (comment)
#3862


Edit:

The "go.formatTool": "gofumpt" works. When I save a file, the extension formats it. The problem is that when I use the "go.formatTool": "custom", the extension catches more cases to format. That tells me that the extension uses its own version of gofumpt, despite that I declare a different path in go.alternateTools to a different version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    tools/managementTools (linter, formatter and third party tools) installation, execution and update.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions