From 06410321e39d505efe4be5755f942271b747aec6 Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Mon, 23 Jun 2014 13:50:14 -0700 Subject: [PATCH] Add script to verify all boilerplate; add line to make travis run it. --- .travis.yml | 1 + hack/verify-boilerplate.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100755 hack/verify-boilerplate.sh diff --git a/.travis.yml b/.travis.yml index 4e9ebd6e8b903..17be10ccc82e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ install: - go get code.google.com/p/go.tools/cmd/cover - go get github.com/coreos/etcd - bad=$(gofmt -s -l pkg/ cmd/) bash -x -c '[[ -z "$bad" ]]' + - ./hack/verify-boilerplate.sh - ./hack/build-go.sh script: diff --git a/hack/verify-boilerplate.sh b/hack/verify-boilerplate.sh new file mode 100755 index 0000000000000..3eeb0fb5063e2 --- /dev/null +++ b/hack/verify-boilerplate.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +REPO_ROOT="$(realpath "$(dirname $0)/..")" + +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 +done + +exit ${result}