报错内容
> golangci-lint run .\pkg\descheduler\controllers\migration\arbitrator\
level=warning msg="[runner] Can't run linter goanalysis_metalinter: gofmt: error computing diff: exec: \"diff\": executable file not found in %PATH%"
level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: gofmt: error computing diff: exec: \"diff\": executable file not found in %PATH%\n\n"
原因
参考资料:https://stackoverflow.com/questions/56206562/why-gofmt-d-gives-computing-diff-exec-diff-executable-file-not-found-in
golangci-lint
需要调用gofmt
执行diff
指令,但是该指令在Windows
上不是默认就有的。
解决方法
git
安装时会自带diff
程序,我们可以将其路径C:\Program Files\Git\usr\bin
添加到环境变量中。