-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f80390
commit 2a30752
Showing
4 changed files
with
310 additions
and
297 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
|
||
STAGED_GO_FILES=$(git diff --cached --name-only | grep ".go$") | ||
|
||
echo "Formatting go files" | ||
for FILE in ${STAGED_GO_FILES} | ||
do | ||
gofmt -w -s "${FILE}" | ||
goimports -w "${FILE}" | ||
git add "${FILE}" | ||
done | ||
|
||
if [[ -n "${STAGED_GO_FILES}" ]]; then | ||
set -o errexit | ||
make lint-fix | ||
make lint | ||
set +o errexit | ||
for FILE in ${STAGED_GO_FILES} | ||
do | ||
git add "${FILE}" | ||
done | ||
fi | ||
|
||
STAGED_TF_FILES=$(git diff --cached --name-only | grep ".tf$") | ||
if [ -n "$STAGED_TF_FILES" ]; then | ||
echo "Checking the format of Terraform files" | ||
make tflint | ||
fi | ||
|
||
STAGED_WEBSITES_FILES=$(git diff --cached --name-only | grep "website/") | ||
if [ -n "$STAGED_WEBSITES_FILES" ]; then | ||
echo "Checking the format of website files" | ||
make website-lint | ||
fi |
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
Oops, something went wrong.