Revert "cmd/go: move automatic testing.Init call into generated test code"

This reverts CL 176098.

Reason for revert: added complexity, but did not completely fix the
underlying problem. A complete solution would not be worth the
complexity, and as a partial solution this is probably not worth the
complexity either.

Updates #31859

Change-Id: Ifd34c292fd1b811c60afe3c339e5edd3f37190c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/186817
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Caleb Spare <cespare@gmail.com>
This commit is contained in:
Bryan C. Mills 2019-07-18 17:34:59 -04:00
parent f518a96e00
commit 5e21032b3d
10 changed files with 44 additions and 150 deletions

View file

@ -1075,11 +1075,6 @@ type testDeps interface {
// It is not meant to be called directly and is not subject to the Go 1 compatibility document.
// It may change signature from release to release.
func MainStart(deps testDeps, tests []InternalTest, benchmarks []InternalBenchmark, examples []InternalExample) *M {
// In most cases, Init has already been called by the testinginit code
// that 'go test' injects into test packages.
// Call it again here to handle cases such as:
// - test packages that don't import "testing" (such as example-only packages)
// - direct use of MainStart (though that isn't well-supported)
Init()
return &M{
deps: deps,