Closed crsdrw closed 5 years ago
It seems to depend on what kind of shell I use. The above reproduction was using windows command prompt. If I use Git bash I don't get the error. With Powershell Console I get the same error.
I wonder if this issue is related to the issue of enabling linters in Visual Studio Code on windows: #222
More info. I have GnuWin32 diff in my path. If I remove it from my path I get this error instead:
level=warning msg="[runner] Can't run linter gofmt: error computing diff: exec: \"diff\": executable file not found in %PATH%"
hi! thank you for the issue looks difficult to reproduce because I have only Mac OS and Linux
@jirfag I think the question is, can golangci-lint be made to work without a "diff" executable. Because that will typically not be available on windows.
does gofmt without golangci-lint work for you? it uses diff
@jirfag Interesting... without any diff executable in my path all the functionality of gofmt works, except gofmt -d. You are right, gofmt -d does use diff. If I have a diff tool such as GnuWin32 DiffUtils in my path then I get the output I expect from gofmt -d .
ok, got it. I've looked into the error text, looks like diff-parsing library doesn't support \r
, I will fix it.
I have created a pull request on the diff-parsing library: https://github.com/sourcegraph/go-diff/pull/29
l have similar question on windows 10,golangci-lint version is V1.32.2 run command:
golangci-lint run
got the error:
level=warning msg="[runner] Can't run linter goanalysis_metalinter: goimports: can't extract issues from gofmt diff output \"\": got no diffs from patch parser: []"
level=error msg="Running error: goimports: can't extract issues from gofmt diff output \"\": got no diffs from patch parser: []"
Has this problem been fixed?thank you!
This issue still exists, I confirm on windows and ubuntu WSL. Installing GnuUtil32Installer.exe then adding bin folder into PATH will resolve this issue on any windows machine
The issue reproduced on windows after upgrading git to version 2.34.1
.
The fix was to add C:\Program Files\git\usr\bin
(where diff.exe is located) to PATH variable.
Still exists.
$ go version
go version go1.19.3 darwin/amd64
$ golangci-lint version
golangci-lint has version 1.50.1 built from 8926a95 on 2022-10-22T10:48:48Z
Error log:
ERRO Running error: 1 error occurred:
* can't run linter goanalysis_metalinter: gofmt: can't extract issues from gofmt diff output "...some codes..."
I got the error
level=warning msg="[runner] Can't run linter goanalysis_metalinter: gofmt: error computing diff: diff resolves to executable relative to current directory (.\\diff)"
level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: gofmt: error computing diff: diff resolves to executable relative to current directory (.\\diff)\n\n"
I have diff.exe in my PATH env,but it didn't work.
For anyone with this problem install the executables and add it to system PATH variable, after that logout and login again.
I am seeing this error in windows.
level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: goimports: can't extract issues from gofmt diff output \"\": got no diffs from patch parser: \n\n"
First I got the error that "diff" was not present in the PATH value. I installed it and added it to the PATH. Then it gave the above error where diff parser did not return any output to goimports.
I'm trying to run golangci-lint with the gofmt linter enabled on windows:
And get the following error:
Verbose output:
Version
Output from
go version && go env
:The file I'm linting has a simple linting error: