cmd/go: document -modfile and other flags for 'go tool'

Mention -modfile, -C, -overlay, and -modcacherw in the 'go tool'
documentation. We let a reference to 'go help build' give a pointer to
more detailed information.

The -modfile flag in particular is newly useful with the Go 1.24 support
for user-defined tools with 'go tool'.

Updates #48429
Updates #33926
Updates #71663
Fixes #71502

Change-Id: Ida67df50ff774a0886733d661a40e27c2cadc0f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/648577
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Conrad Irwin <conrad.irwin@gmail.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
This commit is contained in:
thepudds 2025-02-11 12:59:54 -05:00 committed by Gopher Robot
parent d9cc4944ce
commit b574590c36
2 changed files with 14 additions and 0 deletions

View File

@ -1953,6 +1953,13 @@
// The -n flag causes tool to print the command that would be
// executed but not execute it.
//
// The -modfile=file.mod build flag causes tool to use an alternate file
// instead of the go.mod in the module root directory.
//
// Tool also provides the -C, -overlay, and -modcacherw build flags.
//
// For more about build flags, see 'go help build'.
//
// For more about each builtin tool command, see 'go doc cmd/<command>'.
//
// # Print Go version

View File

@ -46,6 +46,13 @@ 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.
The -modfile=file.mod build flag causes tool to use an alternate file
instead of the go.mod in the module root directory.
Tool also provides the -C, -overlay, and -modcacherw build flags.
For more about build flags, see 'go help build'.
For more about each builtin tool command, see 'go doc cmd/<command>'.
`,
}