Skip to content

Commit

Permalink
Remove -s flag from gofmt githook
Browse files Browse the repository at this point in the history
The `-s` flag was added to the gofmt githook with the intention of making the code a little more readable and concise. The most frequently affected code includes struct literals which don't require the fields to be explicitly named.

Unfortunately, the latest version of proto gen disallows this, as it interferes with backwards compatibility. As a result, protobuf messages must explicitly name all fields in its struct literals.

Rather than have some structs which appear that they can omit field names but don't, and others that do, let's keep things consistent. This change removes the `-s` flag from the githook.

Signed-off-by: Evan Gilman <[email protected]>
  • Loading branch information
evan2645 committed May 22, 2018
1 parent 37af3ac commit f4f72b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
gofiles=$(git diff --cached --name-only --diff-filter=ACM | grep '\.go$')
[ -z "$gofiles" ] && exit 0

unformatted=$(gofmt -l -s $gofiles)
unformatted=$(gofmt -l $gofiles)
[ -z "$unformatted" ] && exit 0

# Some files are not gofmt'd. Print message and fail.
Expand Down

0 comments on commit f4f72b5

Please sign in to comment.