diff --git a/Makefile b/Makefile index 5979b3577..5b02d736b 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,10 @@ style: @echo ">> checking code style" @! gofmt -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^' +check_license: + @echo ">> checking license header" + @./scripts/check_license.sh + test: @echo ">> running tests" @$(GO) test -short $(pkgs) @@ -54,5 +58,5 @@ assets: @go-bindata $(bindata_flags) -pkg ui -o web/ui/bindata.go -ignore '(.*\.map|bootstrap\.js|bootstrap-theme\.css|bootstrap\.css)' web/ui/templates/... web/ui/static/... -.PHONY: all style format build test vet docker assets tarballs +.PHONY: all style check_license format build test vet docker assets tarballs diff --git a/scripts/check_license.sh b/scripts/check_license.sh new file mode 100755 index 000000000..d3882c6b6 --- /dev/null +++ b/scripts/check_license.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +licRes=$( +for file in $(find . -type f -iname '*.go' ! -path './vendor/*'); do + head -n3 "${file}" | grep -Eq "(Copyright|generated|GENERATED)" || echo -e " ${file}" +done;) +if [ -n "${licRes}" ]; then + echo -e "license header checking failed:\n${licRes}" + exit 255 +fi