From 208da81a53a17bfdb6ac9bda0cc71dd05077d322 Mon Sep 17 00:00:00 2001 From: Jeffrey Regan Date: Tue, 24 Oct 2017 16:05:55 -0700 Subject: [PATCH] Add travis CICD coverage. Also, rename "kexpand" to "kinflate" to ease pronunciation. --- pre-commit.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 pre-commit.sh diff --git a/pre-commit.sh b/pre-commit.sh new file mode 100755 index 000000000..33731b0bf --- /dev/null +++ b/pre-commit.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +if [ -n "$failIt" ]; then + echo "Expecting failIt to be empty." + exit 1 +fi + +tmp=$(gofmt -s -d -l . 2>&1 ) +if [ -n "$tmp" ]; then + printf >&2 'gofmt failed for:\n%s\n' "$tmp" + failIt=1 +fi + +tmp=$(goimports -l .) +if [ -n "$tmp" ]; then + printf >&2 'goimports failed for:\n%s\n' "$tmp" + failIt=1 +fi + +tmp=$(go vet -all ./... 2>&1) +if [ -n "$tmp" ]; then + printf >&2 'govet failed for:\n%s\n' "$tmp" + failIt=1 +fi + +tmp=$(golint ./...) +if [ -n "$tmp" ]; then + printf >&2 'golint failed for:\n%s\n' "$tmp" + failIt=1 +fi + +if [ -n "$failIt" ]; then + unset failIt + exit 1 +fi + +go test -v ./...