-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(githooks): Makefile githooks target and document it
- Loading branch information
Showing
3 changed files
with
12 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,9 @@ | ||
#!/bin/bash | ||
|
||
echo "Executing pre push hook. To disable do 'git push --no-verify'" | ||
STAGED_GO_FILES=$(git diff --cached --name-only | grep ".go$") | ||
|
||
make lint | ||
if [ $? -ne 0 ] | ||
then | ||
echo "***ERROR*** 'make lint' failed. Fix errors before proceeding to push." | ||
exit 1 | ||
if [[ "$STAGED_GO_FILES" = "" ]]; then | ||
exit 0 | ||
fi | ||
|
||
# Note: this won't detect unneeded `// indirect` commented dependencies | ||
go mod tidy | ||
git diff --exit-code -- go.mod go.sum >/dev/null | ||
if [ $? -ne 0 ] | ||
then | ||
echo "***ERROR*** 'go.mod' file is updated. Add the file before proceeding to push." | ||
exit 1 | ||
fi | ||
make lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters