| 1 | #!/bin/bash |
| 2 | |
| 3 | # Verify that the correct license block is present in all Go source |
| 4 | # files. |
| 5 | EXPECTED=$(cat ./scripts/license.txt) |
| 6 | |
| 7 | # Scan each Go source file for license. |
| 8 | EXIT=0 |
| 9 | GOFILES=$(find . -name "*.go") |
| 10 | |
| 11 | for FILE in $GOFILES; do |
| 12 | BLOCK=$(head -n 14 $FILE) |
| 13 | |
| 14 | if [ "$BLOCK" != "$EXPECTED" ]; then |
| 15 | echo "file missing license: $FILE" |
| 16 | EXIT=1 |
| 17 | fi |
| 18 | done |
| 19 | |
| 20 | exit $EXIT |