Skip to content

Instantly share code, notes, and snippets.

@andrewslotin
Last active February 16, 2016 14:58
Show Gist options
  • Save andrewslotin/85d36425d9757ae60cd0 to your computer and use it in GitHub Desktop.
Save andrewslotin/85d36425d9757ae60cd0 to your computer and use it in GitHub Desktop.
Find and run all Go tests in current directory (and subdirectories)
#!/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
#!/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