Skip to content

Commit

Permalink
ci: no-exit: Do not run no-exit check on test files
Browse files Browse the repository at this point in the history
The test files do not have access to our app level
exit() function, and are thus OK to call os.Exit() if
they need. Skip them from the check.

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
  • Loading branch information
Graham Whaley committed Jul 10, 2018
1 parent 62495d4 commit 031632d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions .ci/go-no-os-exit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ echo "Checking for no os.Exit() calls for package [${go_packages}]"
candidates=`go list -f '{{.Dir}}/*.go' $go_packages`
for f in $candidates; do
filename=`basename $f`
# skip all go test files
[[ $filename == *_test.go ]] && continue
# skip exit.go where, the only file we should call os.Exit() from.
[[ $filename == "exit.go" ]] && continue
# skip exit_test.go
[[ $filename == "exit_test.go" ]] && continue
# skip main_test.go
[[ $filename == "main_test.go" ]] && continue
files="$f $files"
done

Expand Down

0 comments on commit 031632d

Please sign in to comment.