From 713a9488a2fa80d88aff7fb45185b79b75134485 Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Tue, 12 Aug 2014 17:16:57 -0700 Subject: [PATCH] Fix verification scripts to actually look at all go files. --- hack/verify-boilerplate.sh | 17 +++++++---------- hack/verify-gofmt.sh | 6 ++++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/hack/verify-boilerplate.sh b/hack/verify-boilerplate.sh index 22155b02566..67106146777 100755 --- a/hack/verify-boilerplate.sh +++ b/hack/verify-boilerplate.sh @@ -14,19 +14,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -REPO_ROOT="$(realpath "$(dirname $0)/..")" +REPO_ROOT="$(cd "$(dirname "$0")/../" && pwd -P)" result=0 -dirs=("pkg" "cmd") - -for dir in ${dirs[@]}; do - for file in $(grep -r -l "" "${REPO_ROOT}/${dir}/" | grep "[.]go"); do - if [[ "$(${REPO_ROOT}/hooks/boilerplate.sh "${file}")" -eq "0" ]]; then - echo "Boilerplate header is wrong for: ${file}" - result=1 - fi - done +gofiles="$(find ${REPO_ROOT} -type f | grep "[.]go$" | grep -v "third_party/\|release/\|output/\|target/")" +for file in ${gofiles}; do + if [[ "$(${REPO_ROOT}/hooks/boilerplate.sh "${file}")" -eq "0" ]]; then + echo "Boilerplate header is wrong for: ${file}" + result=1 + fi done dirs=("cluster" "hack" "hooks") diff --git a/hack/verify-gofmt.sh b/hack/verify-gofmt.sh index 52ea5e19ea1..81491f8d15e 100755 --- a/hack/verify-gofmt.sh +++ b/hack/verify-gofmt.sh @@ -24,9 +24,11 @@ if [[ ${GO_VERSION[2]} != "go1.2" && ${GO_VERSION[2]} != "go1.3" ]]; then exit 0 fi +REPO_ROOT="$(cd "$(dirname "$0")/../" && pwd -P)" -bad=$(gofmt -s -l pkg/ cmd/) -if [ "$?" != "0" ]; then +files="$(find ${REPO_ROOT} -type f | grep "[.]go$" | grep -v "third_party/\|release/\|output/\|target/")" +bad=$(gofmt -s -l ${files}) +if [[ -n "${bad}" ]]; then echo "$bad" exit 1 fi