Skip to content

Instantly share code, notes, and snippets.

@babarot
Created February 16, 2023 01:28
Show Gist options
  • Save babarot/4f4c1fdef2508b49650f2f6ffe7ad4c5 to your computer and use it in GitHub Desktop.
Save babarot/4f4c1fdef2508b49650f2f6ffe7ad4c5 to your computer and use it in GitHub Desktop.
Get go test coverage and open it in browser
#!/bin/bash
out=/tmp/cover.out
html=/tmp/cover.html
go test -cover ./... -coverprofile=$out
go tool cover -html=$out -o $html
open $html
sleep 1
rm $out $html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment