]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: document -modfile and other flags for 'go tool'
authorthepudds <thepudds1460@gmail.com>
Tue, 11 Feb 2025 17:59:54 +0000 (12:59 -0500)
committerGopher Robot <gobot@golang.org>
Wed, 12 Feb 2025 16:15:01 +0000 (08:15 -0800)
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>

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

index 7289b5f4b1e16f28c8f54436841445493e7877a0..fc85995373017d9d7695842c337ef848f0aeb681 100644 (file)
 // 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
index 64c40adab2baa940ec97eafa30b209d66e48bff2..7033eb1d9c3587452bbe842bd6db492f6c52a978 100644 (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>'.
 `,
 }