diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d5e850e --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +test: lint go-test + +lint: + ./lint.sh + +go-test: + go test + +.PHONY: lint test diff --git a/lint.sh b/lint.sh new file mode 100755 index 0000000..9cf850b --- /dev/null +++ b/lint.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -e + +# Test to make sure we didn't get any linting errors +# while also writing the linting errors to stderr +# DEV: `test -z` ensures the value is empty +# DEV: `| tee >(cat >&2)` takes the stdout from `golint` and replays it on stderr +# this way we see the linting errors while still capturing them for `test -z` +test -z "`golint | tee >(cat >&2)`"