tb-dotfiles/home/.zshrc.d/golang-helpers.zsh

12 lines
248 B
Bash
Raw Normal View History

2020-12-31 12:11:07 -05:00
if command -v go &> /dev/null; then
go_coverage() {
(
set -eo pipefail
local -r COVERAGE_OUT="$(mktemp)"
go test -cover -coverprofile="${COVERAGE_OUT}" ./...
go tool cover -func="${COVERAGE_OUT}"
rm -f "${COVERAGE_OUT}"
)
}
fi