Skip to content

Commit

Permalink
_content/ref/mod: add -x and -diff flags to go mod tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
willboland committed Jan 9, 2025
1 parent 500af5d commit 8266f04
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion _content/ref/mod.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 8266f04

Please sign in to comment.