github.com/adecaro/fabric-ca@v2.0.0-alpha+incompatible/scripts/check_imports (about) 1 #!/bin/bash 2 # 3 # Copyright IBM Corp. All Rights Reserved. 4 # 5 # SPDX-License-Identifier: Apache-2.0 6 # 7 8 GOIMPORTS="$GOPATH/bin/goimports" 9 10 if [ ! -f $GOIMPORTS ]; then 11 echo "Installing goimports ..." 12 go get golang.org/x/tools/cmd/goimports 13 if [ $? -ne 0 ]; then 14 echo "Failed to install goimports" 15 exit 1 16 fi 17 fi 18 19 echo "Checking imports ..." 20 found=`$GOIMPORTS -l \`find . -name "*.go" |grep -v "./vendor"\` 2>&1` 21 if [ "$found" != "" ]; then 22 echo "The following files have import problems:" 23 echo "$found" 24 echo "You may run 'goimports -w <file>' to fix each file." 25 exit 1 26 fi 27 echo "All files are properly formatted"