github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/hack/make/validate-test (about) 1 #!/bin/bash 2 3 # Make sure we're not using gos' Testing package any more in integration-cli 4 5 source "${MAKEDIR}/.validate" 6 7 IFS=$'\n' 8 files=( $(validate_diff --diff-filter=ACMR --name-only -- 'integration-cli/*.go' || true) ) 9 unset IFS 10 11 badFiles=() 12 for f in "${files[@]}"; do 13 # skip check_test.go since it *does* use the testing package 14 if [ "$f" = "integration-cli/check_test.go" ]; then 15 continue 16 fi 17 18 # we use "git show" here to validate that what's committed doesn't contain golang built-in testing 19 if git show "$VALIDATE_HEAD:$f" | grep -q testing.T; then 20 badFiles+=( "$f" ) 21 fi 22 done 23 24 if [ ${#badFiles[@]} -eq 0 ]; then 25 echo 'Congratulations! No testing.T found.' 26 else 27 { 28 echo "These files use the wrong testing infrastructure:" 29 for f in "${badFiles[@]}"; do 30 echo " - $f" 31 done 32 echo 33 } >&2 34 false 35 fi