ci: no-exit: Do not run no-exit check on test files

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>
This commit is contained in:
Graham Whaley 2018-07-10 17:04:27 +01:00
parent 62495d45be
commit 031632d5b0

View File

@ -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