Skip to content

Commit

Permalink
fix: search for diff.exe on Windows
Browse files Browse the repository at this point in the history
On Windows searching for `diff` returns PowerShell cmdlet,
rather than diff binary even when it is installed.

Related to golangci#3408.
  • Loading branch information
trollixx committed Oct 4, 2023
1 parent e641317 commit 41bbb85
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/result/processors/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"os"
"runtime"
"strings"

"github.com/golangci/revgrep"
Expand Down Expand Up @@ -35,6 +36,10 @@ func NewDiff(onlyNew bool, fromRev, patchFilePath string, wholeFiles bool) *Diff
}

func (p Diff) Name() string {
if runtime.GOOS == "windows" {
return "diff.exe"
}

return "diff"
}

Expand Down

0 comments on commit 41bbb85

Please sign in to comment.