Last active
March 7, 2019 18:57
-
-
Save cdornsife/172c56a5383c4b2ec871ef9946f03d20 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Author: [email protected] | |
| # gofmt -s -w . | |
| set -o errexit | |
| set -o nounset | |
| set -o pipefail | |
| echo "run tests:" | |
| for i in $(find cmd pkg internal -maxdepth 0 -type d -exec echo ./{}/... \; 2>/dev/null); do | |
| go test $i | |
| done | |
| echo | |
| echo -n "check gofmt: " | |
| ERRORS=$(find cmd pkg internal -type f -name \*.go 2>/dev/null | xargs gofmt -l 2>&1 || true) | |
| if [ -n "${ERRORS}" ]; then | |
| echo "these files need to be gofmt'ed:" | |
| for error in ${ERRORS}; do | |
| echo " $error" | |
| done | |
| echo "FAIL" | |
| exit 1 | |
| fi | |
| echo "PASS" | |
| echo | |
| echo -n "check go vet: " | |
| ERRORS=$(find cmd pkg internal -maxdepth 0 -type d -exec echo ./{}/... \; 2>/dev/null | xargs go vet || true) | |
| if [ -n "${ERRORS}" ]; then | |
| echo "${ERRORS}" | |
| echo "FAIL" | |
| exit 1 | |
| fi | |
| echo "PASS" | |
| echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment