Skip to content

Commit 8fb6a46

Browse files
ConradIrwingopherbot
authored andcommitted
cmd/go: pass os.Args[0] to mod tools
Fixes #70509 Change-Id: I62952c0ac5de456742b7bee3552a0d90238bfde5 Reviewed-on: https://go-review.googlesource.com/c/go/+/631075 Reviewed-by: Michael Matloob <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]>
1 parent d0799a5 commit 8fb6a46

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/cmd/go/internal/tool/tool.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ func runBuiltTool(b *work.Builder, ctx context.Context, a *work.Action) error {
305305

306306
toolCmd := &exec.Cmd{
307307
Path: cmdline[0],
308-
Args: cmdline[1:],
308+
Args: cmdline,
309309
Stdin: os.Stdin,
310310
Stdout: os.Stdout,
311311
Stderr: os.Stderr,

src/cmd/go/testdata/script/tool_exename.txt

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ go tool bar
1212
stdout 'my name is: bar'$GOEXE
1313
! stdout 'a.out'
1414

15+
# Third run: with arguments
16+
# https://go.dev/issue/70509
17+
go tool bar --baz
18+
stdout 'my name is: bar'$GOEXE
19+
! stdout 'a.out'
20+
1521
-- go.mod --
1622
module example.com/foo
1723

0 commit comments

Comments
 (0)