mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 13:42:02 +00:00
Add boilerplate checking to hook
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
KUBE_HOOKS_DIR="$(dirname "$(test -L "$0" && echo "$(dirname $0)/$(readlink "$0")" || echo "$0")")"
|
||||
|
||||
errors=0
|
||||
for file in $(git diff --cached --name-only --diff-filter ACM | grep "\.go" | grep -v "third_party"); do
|
||||
diff="$(git show ":${file}" | gofmt -s -d)"
|
||||
@@ -7,6 +9,11 @@ for file in $(git diff --cached --name-only --diff-filter ACM | grep "\.go" | gr
|
||||
echo "# *** ERROR: *** File ${file} has not been gofmt'd." >> $1
|
||||
errors=1
|
||||
fi
|
||||
boilerplate="$(${KUBE_HOOKS_DIR}/boilerplate.sh ${file})"
|
||||
if [[ "$boilerplate" -eq "0" ]]; then
|
||||
echo "# *** ERROR: *** File ${file} needs the boilerplate header in hooks/boilerplate.txt." >> $1
|
||||
errors=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $errors == "1" ]]; then
|
||||
|
Reference in New Issue
Block a user