tb-dotfiles/chezmoi/dot_zshrc.d/executable_golang-helpers.zsh
2022-04-22 10:06:53 -04:00

11 lines
248 B
Bash

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