Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 18 lines (15 sloc) 462 Bytes
#!/bin/bash
go_packages=.
candidates=`go list -f '{{.Dir}}/*.go' $go_packages`
for f in $candidates; do
filename=`basename $f`
# skip exit.go where, the only file we should call os.Exit() from.
[[ $filename == "exit.go" ]] && continue
# skip *_test.go
[[ $filename == *"_test.go" ]] && continue
files="$f $files"
done
if egrep -n '\<os\.Exit\>' $files; then
echo 'Direct calls to os.Exit() are forbidden, please use exit() so atexit() works'
exit 1
fi