Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: respect -n flag in 'go tool' command #72902

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/cmd/go/internal/tool/tool.go
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ may be defined in the go.mod of the current module.
With no arguments it prints the list of known tools.

The -n flag causes tool to print the command that would be
executed but not execute it.
executed but not execute it. (the path to the executable shown may not actually exist.)

The -modfile=file.mod build flag causes tool to use an alternate file
instead of the go.mod in the module root directory.
@@ -302,6 +302,7 @@ func buildAndRunModtool(ctx context.Context, tool string, args []string) {
p.Internal.OmitDebug = true
p.Internal.ExeName = p.DefaultExecName()

cfg.BuildN = toolN
a1 := b.LinkAction(work.ModeBuild, work.ModeBuild, p)
a1.CacheExecutable = true
a := &work.Action{Mode: "go tool", Actor: work.ActorFunc(runBuiltTool), Args: args, Deps: []*work.Action{a1}}