git-review: add gofmt pre-commit hook

Also change getLines to not strip spaces, making it more generally
useful, and the use it more generally.

Change-Id: I0969a2bee5ec5f331fba82e5902ca9879b988fe8
Reviewed-on: https://go-review.googlesource.com/1610
Reviewed-by: Russ Cox <rsc@golang.org>