Skip to content

go.alternateTools does not automatically add .exe (or similar) on Windows, missing "which" call? #3731

@jakebailey

Description

@jakebailey

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

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    • go version go1.24.1 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • golang.org/x/tools/gopls v0.31.1-0.20250324134734-bf12eb7e7db4+dirty
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.99.0-insider dc289883be5d37d5d2b2f7d30926aa42a3123437
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.47.1
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
    • gopls: /home/jabaile/go/bin/gopls (version: v0.31.1-0.20250324134734-bf12eb7e7db4+dirty built with go: go1.25-2d2bcdd2a)
      gotests: not installed
      gomodifytags: not installed
      impl: not installed
      goplay: not installed
      dlv: /home/jabaile/go/bin/dlv (version: v1.24.1 built with go: go1.24.1)
      golangci-lint: /home/jabaile/work/TypeScript-go/_tools/custom-gcl (version: v1.64.6+dirty built with go: go1.24.1)

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

    "go.lintTool": "golangci-lint",
    "go.alternateTools": {
        "golangci-lint": "${workspaceFolder}/_tools/custom-gcl${env:GOEXE}"
    },

Describe the bug

In order to support users of a repo that are using all OSs, I've had to use ${env:GOEXE} to conditionally add .exe on Windows via the Go extension's environment variable provider when configuring our golangci-lint custom built binary.

It seems to me like this shouldn't be required; using a library like https://www.npmjs.com/package/which on the config would automatically net the correct path with extension for the tool.

Steps to reproduce the behavior:

  1. Configure go.alternateTools without an extension on Windows.
  2. Run the tool (save to lint, or similar)
  3. Linter is not run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions