testcfg: Fix building Go binaries with Go 1.18
Our testcfg package needs to build some of our Go binaries ad-hoc to
make them available to our testing infrastructure. With Go 1.18 this
functionality is broken though: Go tries to automatically detect VCS
information to embed it into the resulting binaries. But because we're
intercepting all Git invocations that are resolved via the system's
PATH
variable in order to verify that we don't ever do that, Go will
also use that intercepting script and consequentially get an error.
Fix this regression by setting up a Git command factory and tweaking the environment to make Go use its binaries.
Changelog: fixed
Fixes #4178 (closed)
Edited by Patrick Steinhardt