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