Skip to content

Instantly share code, notes, and snippets.

@cubicdaiya
Created June 4, 2014 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cubicdaiya/770064e4d928640d9ca1 to your computer and use it in GitHub Desktop.
Save cubicdaiya/770064e4d928640d9ca1 to your computer and use it in GitHub Desktop.
checking go fmt by git-hook
#!/bin/bash
echo "go fmt ./..." $'\n'
result=`go fmt ./...`
if [ "$result" != "" ];
then
msg="You forgot to execute 'go fmt' to the following files"
if [ `uname` = "Darwin" ]; then
echo $'\e[31m'$msg$'\e[m' $'\n'
elif [ `uname` = "Linux" ]; then
echo -e "\e[1;31m$msg\e[m" $'\n'
fi
echo $result $'\n'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment