cmd/coordinator: split subrepo testing into module and GOPATH modes
cmd/coordinator: split subrepo testing into module and GOPATH modes

There are sufficient differences between the work we need to do
to test a subrepo in module mode and GOPATH mode, that it makes
sense to split it into two linear code paths. (I've tried keeping
it inline, but it led to less readable and harder to change code.)

This change is mostly a refactor with the intentional of not changing
any user-visible behavior. Behavior changes will follow in future CLs;
for now they're added as TODO comments.

The GOPATH mode path remains as before; minor improvements will be
applied in the following commit.

The module mode path is reduced to be empty at this time. The main
subrepo being tested is already fetched earlier, and its dependencies
don't need to be placed into a GOPATH workspace in module mode.

Change-Id: Ibfbe30b5d54ebe26cb5a783f0592f754fecfe53d
Reviewed-on: https://go-review.googlesource.com/c/build/+/194357
Run-TryBot: Dmitri Shuralyov <d181b7fea0ec87c86ba5a890ab716db52498e3ba@golang.org>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Brad Fitzpatrick <ae9783c0b0efc69cd85ab025ddd17aa44cdc4aa5@golang.org>
Reviewed-by: Alexander Rakoczy <60c6d277a8bd81de7fdde19201bf9c58a3df08f4@golang.org>

golang/build,golang/build,golang/build,golang/build