-
-
Save andrewslotin/85d36425d9757ae60cd0 to your computer and use it in GitHub Desktop.
Find and run all Go tests in current directory (and subdirectories)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare paths=$(for t in $(find . -name "*_test.go" -not -path "./.go/*"); do dirname $t; done | sort | uniq) | |
declare -i return_value=0 | |
for path in ${paths[@]}; do | |
if go test -i $path; then | |
echo "$path...ok" | |
else | |
return_value=1 | |
fi | |
done | |
exit $return_value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare paths=$(for t in $(find . -name "*_test.go" -not -path "./.go/*"); do dirname $t; done | sort | uniq) | |
declare -i return_value=0 | |
echo -e "\033[0;36mChecking for compile-time errors\033[0m" | |
goba || exit 1 | |
echo -e "\033[0;36mRunning tests\033[0m" | |
for path in ${paths[@]}; do | |
go test $path || return_value=1 | |
done | |
exit $return_value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment