edsrzf/gofmt-git-hook

fmt-check output

Opened this issue · 0 comments

fhs commented

It would be nice if fmt-check printed the gofmt commands to run, so I can just copy&paste them into the terminal. Something like this:

$ git commit -a
Please run these commands to fix formatting and then run git add:
gofmt -w foo.go
gofmt -w bar/buz.go
$

It's easy enough adding the "gofmt -w " before each filename, but I'm not sure how you'd get the relative path. For example, if the current working directory is "bar", it should print:

gofmt -w ../foo.go
gofmt -w buz.go