Skip to content

Commit

Permalink
pre-commit: fixed goword path (pingcap#14524)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekalinin authored and SunRunAway committed Jan 20, 2020
1 parent a5c0d56 commit b8a397d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ readonly reset=$(tput sgr0)
readonly red=$(tput bold; tput setaf 1)
readonly green=$(tput bold; tput setaf 2)

readonly goword=./tools/bin/goword

exit_code=0

# comment it by default. You can uncomment it.
Expand Down Expand Up @@ -53,7 +55,7 @@ files_need_goword=()
files=($(git diff --cached --name-only --diff-filter ACM | grep "\.go" | grep -v -e "^_vendor"))
for file in "${files[@]}"; do
# Check for files that fail goword.
diff=$(goword ${file})
diff=$(${goword} ${file})
if [[ -n "$diff" ]]; then
files_need_goword+=("${file}")
fi
Expand All @@ -63,7 +65,7 @@ if [[ "${#files_need_goword[@]}" -ne 0 ]]; then
echo "${red}ERROR!"
echo "Some files may have spelling errors."
echo "copy and paste the following for where fails this test:"
echo " goword ${files_need_goword[@]}"
echo " $ ${goword} ${files_need_goword[@]}"
exit_code=1
else
echo "${green}OK"
Expand Down

0 comments on commit b8a397d

Please sign in to comment.