Skip to content

Instantly share code, notes, and snippets.

@teepark
Last active August 19, 2016 18:04
Show Gist options
  • Save teepark/03fba013c21aa992fd75dffe4e987a37 to your computer and use it in GitHub Desktop.
Save teepark/03fba013c21aa992fd75dffe4e987a37 to your computer and use it in GitHub Desktop.
colorful go test output
#!/usr/bin/env bash
set -euo pipefail
go test "$@" | \
sed -E \
-e "/^((--- PASS:.*)|(ok.*)|(PASS.*))$/s//$(printf '\033[32m\\1\033[0m')/" \
-e "/^(\\?.*\\[no test files\\])$/s//$(printf '\033[33m\\1\033[0m')/" \
-e "/^(FAIL.*|--- FAIL:.*)$/s//$(printf '\033[31m\\1\033[0m')/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment