diff --git a/home/.zshrc.d/golang-helpers.zsh b/home/.zshrc.d/golang-helpers.zsh new file mode 100755 index 0000000..e984a1b --- /dev/null +++ b/home/.zshrc.d/golang-helpers.zsh @@ -0,0 +1,11 @@ +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