gitaly-hooks: Fix deferred calls never running
While we do defer multiple calls in gitaly-hooks' main function, these
aren't ever: the function never returns, but executes os.Exit()
. While
it's not much of a problem right now because ultimately we do not care
for any of the deferred function calls, it invites for future errors in
case somebody misses the fact that deferred calls never run.
Fix the issue by pulling out the logic into a separate run()
function
which has the usual return semantics.