cmd/bench: move toolchain selection closer to execution

Right now we "iterate" over toolchains (GOROOTs) at the outer-most part
of the tool, but bringing that in closer lets us do things like only
build the benchmarking tools once.

This change also introduces abstractions around the Go tool from the
Sweet tool to simplify and deduplicate some code. For instance, building
bent currently fails with the baseline GOROOT because the GOROOT
environment variable isn't set correctly, but the "gotest" benchmarks

For golang/go#49207.

Change-Id: I6816e1112174f951d3bc22c2b1033b8e98dc0327
Reviewed-by: Michael Pratt <>
Trust: Michael Knyszek <>
Run-TryBot: Michael Knyszek <>
TryBot-Result: Gopher Robot <>
Reviewed-by: David Chase <>
5 files changed