generated from hashicorp/terraform-provider-scaffolding-framework
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
48 changed files
with
3,369 additions
and
482 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,8 +1,26 @@ | ||
set -e | ||
|
||
echo "Running pre-commit hook" | ||
make fmt | ||
make build | ||
go generate ./... | ||
# Add examples and docs files to git after documentation is generated | ||
git add examples/ | ||
git add docs/ | ||
|
||
# First, get a list of all staged go files (ends in .go) | ||
gofiles="$(git diff --cached --name-only --diff-filter=ACM --line-prefix="$(git rev-parse --show-toplevel)"/ '*.go')" | ||
[ -z "$gofiles" ] && exit 0 | ||
|
||
for file in $gofiles; do | ||
echo "running pre commit hook on $file" | ||
# format the file | ||
gofmt -w "$file" | ||
|
||
# run goimports | ||
goimports -w "$file" | ||
|
||
# add the new changes to git commit | ||
git add $file | ||
done | ||
|
||
echo "Pre-commit hook finished" |
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
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
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.