github.com/duglin/docker@v1.13.1/hack/validate/vet (about)

     1  #!/bin/bash
     2  
     3  export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
     4  source "${SCRIPTDIR}/.validate"
     5  
     6  IFS=$'\n'
     7  files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' | grep -v '^api/types/container/' || true) )
     8  unset IFS
     9  
    10  errors=()
    11  for f in "${files[@]}"; do
    12  	failedVet=$(go vet "$f")
    13  	if [ "$failedVet" ]; then
    14  		errors+=( "$failedVet" )
    15  	fi
    16  done
    17  
    18  
    19  if [ ${#errors[@]} -eq 0 ]; then
    20  	echo 'Congratulations!  All Go source files have been vetted.'
    21  else
    22  	{
    23  		echo "Errors from go vet:"
    24  		for err in "${errors[@]}"; do
    25  			echo " - $err"
    26  		done
    27  		echo
    28  		echo 'Please fix the above errors. You can test via "go vet" and commit the result.'
    29  		echo
    30  	} >&2
    31  	false
    32  fi