entrypoint: enable go vet checking on packages

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-03-09 16:13:18 -04:00 committed by Niels de Vos
parent fa3bce7234
commit 3afcc68ac7
1 changed files with 7 additions and 3 deletions

View File

@ -98,6 +98,12 @@ test_pkg() {
if [[ "${TEST_PKG}" && "${TEST_PKG}" != "${pkg}" ]]; then if [[ "${TEST_PKG}" && "${TEST_PKG}" != "${pkg}" ]]; then
return 0 return 0
fi fi
# run go vet and capture the result for the package, but still execute the
# test suite anyway
show go vet ${BUILD_TAGS} "./${pkg}"
ret=$?
# disable caching of tests results # disable caching of tests results
testargs=("-count=1"\ testargs=("-count=1"\
${BUILD_TAGS}) ${BUILD_TAGS})
@ -118,7 +124,7 @@ test_pkg() {
fi fi
show go test -v "${testargs[@]}" "./${pkg}" show go test -v "${testargs[@]}" "./${pkg}"
ret=$? ret=$(($?+${ret}))
grep -v "^mode: count" "${pkg}.cover.out" >> "cover.out" grep -v "^mode: count" "${pkg}.cover.out" >> "cover.out"
return ${ret} return ${ret}
} }
@ -128,8 +134,6 @@ pre_all_tests() {
go get -t -v ${BUILD_TAGS} ./... go get -t -v ${BUILD_TAGS} ./...
diff -u <(echo -n) <(gofmt -d -s .) diff -u <(echo -n) <(gofmt -d -s .)
# TODO: Consider enabling go vet but it currently fails
# Reset whole-module coverage file # Reset whole-module coverage file
echo "mode: count" > "cover.out" echo "mode: count" > "cover.out"
} }