Upgrade test.sh to catch golint errors

This commit is contained in:
Richard Barnes 2015-10-05 00:12:24 -04:00
parent df87fcd739
commit fd42948605
1 changed files with 24 additions and 2 deletions

26
test.sh
View File

@ -146,7 +146,18 @@ GOBIN=${GOBIN:-$HOME/gopath/bin}
#
if [[ "$RUN" =~ "vet" ]] ; then
start_context "test/vet"
run_and_comment go vet ./...
check_go_vet() {
errors=$(go vet ./...)
if [ "x${errors}" == "x" ]; then
return 0
else
# Re-run to display the errors
go vet ./...
return 1
fi
}
run_and_comment check_go_vet
end_context #test/vet
fi
@ -155,7 +166,18 @@ fi
#
if [[ "$RUN" =~ "lint" ]] ; then
start_context "test/golint"
[ -x "$(which golint)" ] && run golint -min_confidence=0.9 ./...
check_golint() {
errors=$([ -x "$(which golint)" ] && golint -min_confidence=0.81 ./...)
if [ "x${errors}" == "x" ]; then
return 0
else
# Re-run to display the errors
[ -x "$(which golint)" ] && run golint -min_confidence=0.81 ./...
return 1
fi
}
run_and_comment check_golint
end_context #test/golint
fi