diff options
author | Brad Fitzpatrick <bradfitz@golang.org> | 2011-06-07 11:53:47 -0700 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2011-06-07 11:53:47 -0700 |
commit | be48115f48b4a8e827502771599ee274aaba3117 (patch) | |
tree | f6751af514f4778e290aa9cc99b31c086869e5d4 | |
parent | 63dae3c3becfabce9454e062297f8b4a22fc69a9 (diff) | |
download | go-be48115f48b4a8e827502771599ee274aaba3117.tar.gz go-be48115f48b4a8e827502771599ee274aaba3117.zip |
gofix: fix diff regression from exec change
Also pass -u to diff to be consistent with gofmt.
Fixes #1619
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4591041
-rw-r--r-- | src/cmd/gofix/main.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cmd/gofix/main.go b/src/cmd/gofix/main.go index ba2061a000..1b091c18aa 100644 --- a/src/cmd/gofix/main.go +++ b/src/cmd/gofix/main.go @@ -248,5 +248,11 @@ func diff(b1, b2 []byte) (data []byte, err os.Error) { f1.Write(b1) f2.Write(b2) - return exec.Command("diff", f1.Name(), f2.Name()).CombinedOutput() + data, err = exec.Command("diff", "-u", f1.Name(), f2.Name()).CombinedOutput() + if len(data) > 0 { + // diff exits with a non-zero status when the files don't match. + // Ignore that failure as long as we get output. + err = nil + } + return } |