github.com/simranvc/fabric-ca@v0.0.0-20191030094829-acc364294dde/scripts/check_lint (about)

     1  #!/bin/bash
     2  #
     3  # Copyright IBM Corp. All Rights Reserved.
     4  #
     5  # SPDX-License-Identifier: Apache-2.0
     6  #
     7  
     8  GOLINT="$GOPATH/bin/golint"
     9  
    10  function runlint {
    11     for dir in `ls`
    12     do
    13        if [ -d $dir ]; then
    14          case "$dir" in
    15           vendor|bin|testdata|scripts)
    16             ;;
    17          *)
    18             $GOLINT $dir/...
    19             ;;
    20          esac
    21        fi
    22     done
    23  }
    24  
    25  if [ ! -f $GOLINT ]; then
    26     echo "Installing golint ..."
    27     go get -u golang.org/x/lint/golint
    28  fi
    29  
    30  echo "Running lint ..."
    31  found=$(runlint)
    32  if [ "$found" != "" ]; then
    33     echo "YOU MUST FIX THE FOLLOWING LINT PROBLEMS:"
    34     echo "$found"
    35     echo "END LINT PROBLEMS"
    36     exit 1
    37  fi
    38  echo "No lint errors were found"