testhelper: Unify building of Go binaries
Some of our tests rely on some Gitaly commands being built. In order to
still allow for go test to be used without having to manually build
them, we thus have a set of functions in our testhelper which does build
them for us, but they all use the same boiler plate without any kind of
unification.
Implement a new buildCommand function and refactor existing code to
use it to avoid this duplicated code.