]> Cypherpunks repositories - gostls13.git/commitdiff
gofmt: fix -d regression from exec change
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 7 Jun 2011 16:38:04 +0000 (09:38 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 7 Jun 2011 16:38:04 +0000 (09:38 -0700)
Fixes #1916

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4590041

src/cmd/gofmt/gofmt.go

index 16bcd3c4df1253ae88bb5a0882c43030aa630ffd..ea1c1b00ff789e810b9a4008cf5f93e03d355c46 100644 (file)
@@ -260,5 +260,12 @@ func diff(b1, b2 []byte) (data []byte, err os.Error) {
        f1.Write(b1)
        f2.Write(b2)
 
-       return exec.Command("diff", "-u", 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
+
 }