github.com/tigera/api@v0.0.0-20240320170621-278e89a8c5fb/hack/check-copyright.sh (about) 1 #!/bin/sh 2 3 # Get all golang files in the repo, excluding the vendor dir. 4 files=$(find . -path ./vendor -prune -o -name "*.go" -type f | grep -v vendor) 5 nocopyright="" 6 for f in $files 7 do 8 # For each file, check if it contains "Copyright" in the first three lines. 9 exists=$(head -n 4 $f | grep "Copyright (c).*Tigera") 10 if [ -z "$exists" ]; then 11 nocopyright="$nocopyright\n$f" 12 fi 13 done 14 15 # If any files are missing a copyright, then exit with an error code. 16 if [ ! -z "$nocopyright" ]; then 17 echo "Files missing copyright: \n$nocopyright" 18 exit 1 19 fi