Skip to content

Instantly share code, notes, and snippets.

@dev-rice
Last active January 24, 2019 17:01
Show Gist options
  • Save dev-rice/382ca7d9555b99b536c0738ea7bfce03 to your computer and use it in GitHub Desktop.
Save dev-rice/382ca7d9555b99b536c0738ea7bfce03 to your computer and use it in GitHub Desktop.
Run go tests automatically (now with COLOR!)
#!/bin/sh
# TODO make the sed to color 'ok' only color 'ok '
go test ./... $@ | sed ''/PASS/s//$(printf "\033[32mPASS\033[0m")/'' | sed ''/FAIL/s//$(printf "\033[31mFAIL\033[0m")/'' | sed ''/ok/s//$(printf "\033[32mok\033[0m")/''
#!/bin/sh
cmd='echo "$(printf "\033[34m===== RUNNING TESTS =====\033[0m")" && go_test_color -cover; echo'
eval $cmd
reflex -r '\.go$' -- sh -c "eval $cmd" | sed "s/^\[00\] //g"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment