Skip to content

Instantly share code, notes, and snippets.

@peterbourgon
Created September 5, 2019 01:22
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save peterbourgon/4288a092ce0f962f5b14e2457085a815 to your computer and use it in GitHub Desktop.
Save peterbourgon/4288a092ce0f962f5b14e2457085a815 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
function for_all_test_files { find ./{cmd,pkg} -name '*_test.go' ; }
function first_line_of_test { xargs -n1 awk '/^func Test/{getline; print FILENAME ":" NR-1 " " $0}' ; }
function not_parallel { grep -v 't.Parallel()' ; }
if for_all_test_files | first_line_of_test | not_parallel
then
echo FAIL: not all tests call t.Parallel
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment