Skip to content

cmd/go: tool should explicitely reject an empty tool name #74757

@dolmen

Description

@dolmen

Go version

go version go1.24.5 darwin/arm64

Output of go env in your module/workspace:

GOROOT='/opt/homebrew/Cellar/go/1.24.5/libexec'

What did you do?

$ go tool !
go: no such tool "!"
$ go tool ""
go tool : fork/exec /opt/homebrew/Cellar/go/1.24.5/libexec/pkg/tool/darwin_arm64: permission denied

What did you see happen?

The error message shows that the tool execution failure is caught by the OS which was given a directory path instead of a executable file path.

What did you expect to see?

go tool should reject much earlier such an invalid tool name and immediately fail with an error message.

$ go tool ""
go: no such tool ""

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixPendingIssues that have a fix which has not yet been reviewed or submitted.GoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolProposalIssues describing a requested change to a Go tool or command-line program.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions