From: Brad Fitzpatrick Date: Tue, 7 Jun 2011 18:53:47 +0000 (-0700) Subject: gofix: fix diff regression from exec change X-Git-Tag: weekly.2011-06-09~36 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=be48115f48b4a8e827502771599ee274aaba3117;p=gostls13.git 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 --- 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 }