简体   繁体   English

Golang Pre commit hook 抛出错误 https://github.com/dnephin/pre-commit-golang

[英]Golang Pre commit hook throwing error https://github.com/dnephin/pre-commit-golang

Check for added large files..............................................Passed
Don't commit to branch...................................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
Check Yaml...............................................................Passed
goimports................................................................Failed
- hook id: goimports
- exit code: 1
Executable `goimports` not found

When running golang pre hook commit I am getting the above error.运行 golang pre hook commit 时,出现上述错误。 I did try to install golang.org/x/tools/cmd/goimports but it still gives me the error.我确实尝试安装 golang.org/x/tools/cmd/goimports 但它仍然给我错误。 Any suggestion how to resolve this will be appreciated任何解决此问题的建议将不胜感激

it looks like goimports needs to be installed and managed externally to pre-commit (escaping the normal supported pathway)看起来需要在外部安装和管理goimports以进行pre-commit (逃避正常支持的路径)

from the readme自述文件

  • go-imports - Runs goimports , requires golang.org/x/tools/cmd/goimports go-imports - 运行goimports ,需要goimports

so you'll need to make sure that tool is installed and globally available所以你需要确保该工具已安装并且在全球范围内可用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM