Skip to content

Commit

Permalink
build/test.sh: fix for handling vet false positive in newer go version.
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-obx committed Feb 16, 2024
1 parent 3091bd4 commit 625aa1f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions build/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ fi

echo "******** Testing: go vet ********"
set +e
go_vet_result=$(go 2>&1 vet ./...)
# ignore '# <package>' comments to stablize checking false positive below;
# newer go version outputs a second-line with bracket ('# [<package]').
go_vet_result=$(go 2>&1 vet ./... | grep -v ^#)
go_vet_rc=$?
set -e
echo "$go_vet_result"
go_vet_result_lines=$(echo "$go_vet_result" | wc -l)
if [ $go_vet_rc -ne 0 ]; then
if [[ $go_vet_result_lines -eq 2 && $go_vet_result == *objectbox[/\\]c-callbacks.go*possible\ misuse\ of\ unsafe.Pointer* ]]; then
if [[ $go_vet_result_lines -eq 1 && $go_vet_result == *objectbox[/\\]c-callbacks.go*possible\ misuse\ of\ unsafe.Pointer* ]]; then
echo "Ignoring known false positive of go vet"
go_vet_rc=0
else
Expand Down

0 comments on commit 625aa1f

Please # to comment.