Skip to content

Commit

Permalink
*: improve pre-commit hook (pingcap#3151)
Browse files Browse the repository at this point in the history
1. commented make test
2. improved goword test
  • Loading branch information
zhexuany authored and coocood committed Apr 26, 2017
1 parent 95b2951 commit 45715cc
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ readonly green=$(tput bold; tput setaf 2)

exit_code=0

echo -ne "Checking that it builds..."
if ! OUT=$(make 2>&1); then
echo
echo "${red}${OUT}"
exit_code=1
else
echo "${green}OK"
fi
echo "${reset}"
# comment it by default. You can uncomment it.
# echo -ne "Checking that it builds..."
# if ! OUT=$(make 2>&1); then
# echo
# echo "${red}${OUT}"
# exit_code=1
# else
# echo "${green}OK"
# fi
# echo "${reset}"

echo -ne "Checking for files that need gofmt... "
files_need_gofmt=()
Expand Down Expand Up @@ -59,8 +60,8 @@ done
if [[ "${#files_need_goword[@]}" -ne 0 ]]; then
echo "${red}ERROR!"
echo "Some files may have spelling errors."
# echo ${files_need_goword[@]}
echo "make goword for more details"
echo "copy and paste the following for where fails this test:"
echo " goword ${files_need_goword[@]}"
exit_code=1
else
echo "${green}OK"
Expand Down

0 comments on commit 45715cc

Please sign in to comment.