aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwillboland <hwilliam.boland@gmail.com>2025-01-09 02:53:48 +0000
committerGopher Robot <gobot@golang.org>2025-02-03 08:00:55 -0800
commit9d27ca2ee513b77cdf8415fc151f567a84617f1c (patch)
treefdc78bdc15dada923d8796618835c6a84320104e
parenta9d101ec2273e6c264f4991762db26eed637ca4c (diff)
downloadgo-x-website-9d27ca2ee513b77cdf8415fc151f567a84617f1c.tar.xz
_content/ref/mod: add -x and -diff flags to go mod tidy
Existing documentation for go mod tidy is missing -x and -diff flags. Adds these flags to the documentation. Fixes golang/go#69936 Change-Id: I00764066684461d38684b5711a17483819b50904 GitHub-Last-Rev: 8266f0485ecedfc604c696e10a86806c82ba6952 GitHub-Pull-Request: golang/website#304 Reviewed-on: https://go-review.googlesource.com/c/website/+/639275 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
-rw-r--r--_content/ref/mod.md8
1 files changed, 7 insertions, 1 deletions
diff --git a/_content/ref/mod.md b/_content/ref/mod.md
index 7de7be65..cce8160e 100644
--- a/_content/ref/mod.md
+++ b/_content/ref/mod.md
@@ -2272,7 +2272,7 @@ requirements and to drop unused requirements.
Usage:
```
-go mod tidy [-e] [-v] [-go=version] [-compat=version]
+go mod tidy [-e] [-v] [-x] [-diff] [-go=version] [-compat=version]
```
`go mod tidy` ensures that the `go.mod` file matches the source code in the
@@ -2287,6 +2287,12 @@ despite errors encountered while loading packages.
The `-v` flag causes `go mod tidy` to print information about removed modules
to standard error.
+The `-x` flag causes `go mod tidy` to print the commands `tidy` executes.
+
+The `-diff` flag causes `go mod tidy` not to modify go.mod or go.sum but
+instead print the necessary changes as a unified diff. It exits
+with a non-zero code if the diff is not empty.
+
`go mod tidy` works by loading all of the packages in the [main
module](#glos-main-module), all of its tools, and all of the packages they import,
recursively. This includes packages imported by tests (including tests in other