github.com/duglin/docker@v1.13.1/hack/validate/test-imports (about) 1 #!/bin/bash 2 # Make sure we're not using gos' Testing package any more in integration-cli 3 4 export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 5 source "${SCRIPTDIR}/.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 if [ "$(echo $f | grep '_test')" ]; then 21 # allow testing.T for non- _test files 22 badFiles+=( "$f" ) 23 fi 24 fi 25 done 26 27 if [ ${#badFiles[@]} -eq 0 ]; then 28 echo 'Congratulations! No testing.T found.' 29 else 30 { 31 echo "These files use the wrong testing infrastructure:" 32 for f in "${badFiles[@]}"; do 33 echo " - $f" 34 done 35 echo 36 } >&2 37 false 38 fi