diff options
| author | yongqijia <YongqiJia520@gmail.com> | 2026-03-03 14:22:28 +0800 |
|---|---|---|
| committer | Alan Donovan <adonovan@google.com> | 2026-03-27 09:24:37 -0700 |
| commit | 2d72c268ea10db520b7dd99802cf2aa40b18c1af (patch) | |
| tree | 35576a496e9be3abf59fa3ca0215d6da2d49e20b /src/database | |
| parent | 7f2e2fd71f0b25fde6031b8317f525f1a2739e9b (diff) | |
| download | go-2d72c268ea10db520b7dd99802cf2aa40b18c1af.tar.xz | |
cmd/fix: change -diff to exit 1 if diffs exist
Currently "go fix -diff" and "go vet -fix -diff" always exit with status
0 even when they print diffs, which is inconsistent with "gofmt -d"
(#46289) and "go mod tidy -diff" (#27005) that exit non-zero when diffs
are present.
The root cause is that the default VetHandleStdout (copyToStdout) simply
copies the tool stdout through without checking whether any content was
produced. This change installs a new copyAndDetectDiff handler in -diff
mode that copies the tool stdout through and calls base.SetExitStatus(1)
when content is present, matching the pattern used by "go mod tidy -diff".
Fixes #77583
Change-Id: I588fbaae8b3690da2f821240baa4a3b14b78f280
Reviewed-on: https://go-review.googlesource.com/c/go/+/749700
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/database')
0 files changed, 0 insertions, 0 deletions
