-1
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 Go pre hook commit I am getting the above error. I did try to install golang.org/x/tools/cmd/goimports but it still gives me the error. Any suggestion how to resolve this will be appreciated

torek
  • 448,244
  • 59
  • 642
  • 775
EagerLearner
  • 447
  • 1
  • 5
  • 11

1 Answers1

1

it looks like goimports needs to be installed and managed externally to pre-commit (escaping the normal supported pathway)

from the readme

  • go-imports - Runs goimports, requires golang.org/x/tools/cmd/goimports

so you'll need to make sure that tool is installed and globally available

anthony sottile
  • 61,815
  • 15
  • 148
  • 207