From fb23209512b65684cd6eefdacc214807474bf9f6 Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Sat, 18 Aug 2018 16:59:18 -0700
Subject: [PATCH] Missing dep

---
 tools/coverage.sh | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100755 tools/coverage.sh

diff --git a/tools/coverage.sh b/tools/coverage.sh
new file mode 100755
index 0000000..0afd4f1
--- /dev/null
+++ b/tools/coverage.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+#
+# Code coverage generation
+
+COVERAGE_DIR="${COVERAGE_DIR:-coverage}"
+PKG_LIST=$(go list ./... | grep -v /vendor/)
+
+# Create the coverage files directory
+mkdir -p "$COVERAGE_DIR";
+
+# Create a coverage file for each package
+for package in ${PKG_LIST}; do
+    go test -covermode=count -coverprofile "${COVERAGE_DIR}/${package##*/}.cov" "$package" ;
+done ;
+
+# Merge the coverage profile files
+echo 'mode: count' > "${COVERAGE_DIR}"/coverage.cov ;
+tail -q -n +2 "${COVERAGE_DIR}"/*.cov >> "${COVERAGE_DIR}"/coverage.cov ;
+
+# Display the global code coverage
+go tool cover -func="${COVERAGE_DIR}"/coverage.cov ;
+
+# If needed, generate HTML report
+if [ "$1" == "html" ]; then
+    go tool cover -html="${COVERAGE_DIR}"/coverage.cov -o coverage.html ;
+fi
+
+# Remove the coverage files directory
+rm -rf "$COVERAGE_DIR";
-- 
GitLab