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 ""

Comment From: dolmen

The implementation of tool lookup is in cmd/go/internal/base.Tool and ToolPath.

Comment From: dolmen

Patch in progress...

Comment From: gopherbot

Change https://go.dev/cl/690435 mentions this issue: cmd/go/internal/base: reject an empty tool name

Comment From: gabyhelp

Related Issues

Related Code Changes

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

Comment From: mknyszek

CC @golang/command-line