1
0
mirror of https://github.com/golang/go synced 2024-11-19 14:54:43 -07:00

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
This commit is contained in:
Brad Fitzpatrick 2011-06-07 11:53:47 -07:00
parent 63dae3c3be
commit be48115f48

View File

@ -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
}