Prevent Git Commits with Unformatted Go Code

from blog Blog on hjr265.me, | ↗ original
Git has this great feature that I think is well-known but under-used. I am talking about Git hooks. With Git hooks, you can run scripts during different Git actions. Like this one: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #!/bin/sh GOFILES=`git diff --name-only --cached | grep -e '.go$' | grep -ve 'vendor/'` UNFMTFILES=() for f in $GOFILES; do...