github.com/cyverse/go-irodsclient@v0.13.2/tools/lint.sh (about) 1 #!/bin/bash 2 3 #Exit upon failure 4 set -e 5 6 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" 7 export PATH=$PATH:$GOPATH/bin 8 9 if ! command -v golint &> /dev/null ; then 10 go install golang.org/x/lint/golint 11 fi 12 13 if ! command -v ineffassign &> /dev/null ; then 14 go get github.com/gordonklaus/ineffassign 15 go install github.com/gordonklaus/ineffassign 16 fi 17 18 if ! command -v misspell &> /dev/null ; then 19 go get github.com/client9/misspell/cmd/misspell 20 go install github.com/client9/misspell/cmd/misspell 21 fi 22 23 go mod tidy 24 25 26 for PACKAGE in "fs" "irods" "test" 27 do 28 PACKAGE_DIR="$SCRIPT_DIR/../$PACKAGE" 29 for dir in $(go list $PACKAGE_DIR/...); do golint $dir; done | tee /tmp/output.txt 30 test $(cat /tmp/output.txt | wc -l) -eq 0 31 ineffassign $PACKAGE_DIR 32 misspell -error $PACKAGE_DIR 33 done