diff options
Diffstat (limited to 'src/testing/testing.go')
| -rw-r--r-- | src/testing/testing.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go index 7db7c630c2..2f05203f27 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -1078,6 +1078,11 @@ 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, |
