Skip to content

Commit

Permalink
fix: [#85] Exclude files from go coverage (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbp-bvanb authored Oct 18, 2024
1 parent a82a263 commit 32d0d6c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/go-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ variables() {
fi
fi

if [ -n "${COVERPKG}" ]; then
COVERPKG="-coverpkg=${COVERPKG}"
fi

if [ -n "${COVERPROFILE}" ]; then
COVERPROFILE="-coverprofile=${COVERPROFILE}"
fi
Expand All @@ -27,8 +23,15 @@ variables() {
TAGS="--tags=${TAGS}"
fi

GO_LIST_TEST_EXCLUSIONS=$(go list $TAGS ./... | grep -v ${GOLANG_TEST_EXCLUSIONS})

if [ -n "${COVERPKG}" ]; then
COVERPKG="-coverpkg=$(echo "${GO_LIST_TEST_EXCLUSIONS}" | tr '\n' ',')"
fi

echo "COVERPKG: ${COVERPKG}"
echo "COVERPROFILE: ${COVERPROFILE}"
echo "GO_LIST_TEST_EXCLUSIONS: ${GO_LIST_TEST_EXCLUSIONS}"
echo "GOLANG_PARALLEL_TESTS: ${GOLANG_PARALLEL_TESTS}"
echo "GOLANG_TEST_EXCLUSIONS: ${GOLANG_TEST_EXCLUSIONS}"
echo "TAGS: ${TAGS}"
Expand All @@ -43,7 +46,7 @@ run_go_tests() {
$COVERPKG \
$COVERPROFILE \
$TAGS \
$(go list $TAGS ./... | grep -v ${GOLANG_TEST_EXCLUSIONS})
$(echo "${GO_LIST_TEST_EXCLUSIONS}")
}

main() {
Expand Down

0 comments on commit 32d0d6c

Please sign in to comment.