Commit 12991a75 authored by David du Colombier's avatar David du Colombier

cmd/gofmt: fix diff on Plan 9

On Plan 9, GNU diff is called ape/diff.

Fixes #18999.

Change-Id: I7cf6c23c97bcc47172bbf838fd9dd72aefa4c18b
Reviewed-on: https://go-review.googlesource.com/36650Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent af59742d
......@@ -243,7 +243,12 @@ func diff(b1, b2 []byte, filename string) (data []byte, err error) {
f1.Write(b1)
f2.Write(b2)
data, err = exec.Command("diff", "-u", f1.Name(), f2.Name()).CombinedOutput()
cmd := "diff"
if runtime.GOOS == "plan9" {
cmd = "/bin/ape/diff"
}
data, err = exec.Command(cmd, "-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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment