github.com/kchristidis/fabric@v1.0.4-0.20171028114726-837acd08cde1/scripts/golinter.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright Greg Haskins All Rights Reserved.
     4  #
     5  # SPDX-License-Identifier: Apache-2.0
     6  #
     7  
     8  
     9  set -e
    10  
    11  declare -a arr=(
    12  "./bccsp"
    13  "./common"
    14  "./core"
    15  "./events"
    16  "./examples"
    17  "./gossip"
    18  "./msp"
    19  "./orderer"
    20  "./peer"
    21  "./protos"
    22  )
    23  
    24  for i in "${arr[@]}"
    25  do
    26      echo "Checking $i"
    27      go vet $i/...
    28      OUTPUT="$(goimports -srcdir $GOPATH/src/github.com/hyperledger/fabric -l $i)"
    29      if [[ $OUTPUT ]]; then
    30  	echo "The following files contain goimports errors"
    31  	echo $OUTPUT
    32  	echo "The goimports command must be run for these files"
    33  	exit 1
    34      fi
    35  done