cmd/gofmt: change -d to exit 1 if diffs exist
When using the -d flag, set the exit code to 1 if there is a diff.
Fixes #46289
Change-Id: I802e8ccd1798ed7f4448696bec4bc82835ec71a2
GitHub-Last-Rev:
db2207fba9a8f7a2f50138ec1f086ac6a74e1b10
GitHub-Pull-Request: golang/go#75649
Reviewed-on: https://go-review.googlesource.com/c/go/+/707635
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>