git-review: add gofmt command

- move gofmt invocation code from hook.go into gofmt.go
- use true branch point instead of HEAD^
- handle gofmt errors (syntax errors in Go files)
- apply gofmt command to both index and working tree, independently
- fix gofmt pre-commit hook to use index, not working tree

Change-Id: I7ed11c52531bb63b8af9ca5dd881bbfcdf5d5413
Reviewed-by: Andrew Gerrand <>
Reviewed-by: Austin Clements <>
9 files changed
tree: 905b12021663cf71990cec8282f6b93ee7c6480c
  2. git-review/