github.com/mheon/docker@v0.11.2-0.20150922122814-44f47903a831/hack/make/validate-lint (about) 1 #!/bin/bash 2 3 source "${MAKEDIR}/.validate" 4 5 IFS=$'\n' 6 files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) ) 7 unset IFS 8 9 errors=() 10 for f in "${files[@]}"; do 11 # we use "git show" here to validate that what's committed passes go vet 12 failedLint=$(golint "$f") 13 if [ "$failedLint" ]; then 14 errors+=( "$failedLint" ) 15 fi 16 done 17 18 if [ ${#errors[@]} -eq 0 ]; then 19 echo 'Congratulations! All Go source files have been linted.' 20 else 21 { 22 echo "Errors from golint:" 23 for err in "${errors[@]}"; do 24 echo "$err" 25 done 26 echo 27 echo 'Please fix the above errors. You can test via "golint" and commit the result.' 28 echo 29 } >&2 30 false 31 fi