The source project of this merge request has been removed.
bug: Fix incorrect return code handling
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA
The $?
construct refers to the latest command return code. The way it was written, $?
was checking the echo
's return code instead of the go build
one - which was actually the command to check. echo
seldom fails so potential build errors were being masked.
$ false
$ echo $?
1
$ bad_rc() { false; echo "building ..."; if [ $? -ne 0 ]; then echo "build failed"; return 1; fi; }
$ bad_rc
building ...
Edited by 🤖 GitLab Bot 🤖