github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/hack/make/validate-vet (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 failedVet=$(go vet "$f") 12 if [ "$failedVet" ]; then 13 errors+=( "$failedVet" ) 14 fi 15 done 16 17 18 if [ ${#errors[@]} -eq 0 ]; then 19 echo 'Congratulations! All Go source files have been vetted.' 20 else 21 { 22 echo "Errors from go vet:" 23 for err in "${errors[@]}"; do 24 echo " - $err" 25 done 26 echo 27 echo 'Please fix the above errors. You can test via "go vet" and commit the result.' 28 echo 29 } >&2 30 false 31 fi