Proposal Details

Add support for package pattern in "go tool". If the argument to "go tool" is detected as a pattern, match the pattern against the declared tools in go.mod.

Rationale

go get -tool . works. go run . works. But go tool . doesn't work: go: no such tool "."

go tool . should work too, like go tool $(go list .) go get -tool ./internal/mytool && go tool ./internal/mytool should work too, like go get -tool ./internal/mytool && go tool $(go list ./internal/mytool)

Comment From: seankhliao

This is just pointless complication. Currently tool is consistent in requiring a name. If you can use relative paths, then just use go run, having more ways to do the same thing is worse.

Comment From: dolmen

However go run eats exit code and prints it. Also it badly handles flags: it eats arguments like <file.go>. go tool doesn't have those flaws.