You've already forked go-semantic-release
build(githooks): add githooks
This commit is contained in:
23
.githooks/pre-commit
Executable file
23
.githooks/pre-commit
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
## this will retrieve all of the .go files that have been
|
||||
## changed since the last commit
|
||||
STAGED_GO_FILES=$(git diff --cached --name-only -- '*.go')
|
||||
|
||||
if [[ $STAGED_GO_FILES == "" ]]; then
|
||||
echo "No Go Files to Update"
|
||||
## otherwise we can do stuff with these changed go files
|
||||
else
|
||||
for file in $STAGED_GO_FILES; do
|
||||
## format our file
|
||||
go fmt $file
|
||||
## add any potential changes from our formatting to the
|
||||
## commit
|
||||
git add $file
|
||||
done
|
||||
fi
|
||||
|
||||
echo "go test"
|
||||
go test .././...
|
||||
|
||||
echo "golangci-lint run"
|
||||
golangci-lint run
|
||||
Reference in New Issue
Block a user