diff options
author | David du Colombier <0intro@gmail.com> | 2017-02-08 23:11:15 +0100 |
---|---|---|
committer | David du Colombier <0intro@gmail.com> | 2017-02-08 22:29:33 +0000 |
commit | 12991a75e0d93443642137d63719d63c286729be (patch) | |
tree | 9c59b711e33a48e109808ee8a13d44eab0cc2342 /src/cmd/gofmt | |
parent | af59742d0f6abe96eb5d68151b4d2ccb45d5ed89 (diff) | |
download | go-12991a75e0d93443642137d63719d63c286729be.tar.gz go-12991a75e0d93443642137d63719d63c286729be.zip |
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/36650
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/gofmt')
-rw-r--r-- | src/cmd/gofmt/gofmt.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cmd/gofmt/gofmt.go b/src/cmd/gofmt/gofmt.go index cf1ddea917..ff38df7ee4 100644 --- a/src/cmd/gofmt/gofmt.go +++ b/src/cmd/gofmt/gofmt.go @@ -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. |