Skip to content

Commit

Permalink
Add script to verify all boilerplate; add line to make travis run it.
Browse files Browse the repository at this point in the history
  • Loading branch information
lavalamp committed Jun 23, 2014
1 parent 49c25a4 commit 0641032
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 18 additions & 0 deletions hack/verify-boilerplate.sh
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit 0641032

Please sign in to comment.