go/ssa: synthesize Go 1.8-compatible test main package

...to match the new interface between "go test" and the standard testing
package.

Rather than generate SSA code directly, which was tricky and fragile, we
now generate source just as "go test" does, type-check it, and build an
SSA package from it.  crawshaw suggested I do this in the very first
version of testmain.go, but at the time I believed it to be infeasible.

The testMainStartBodyHook mechanism has gone away; installations that
needed it can now achieve the same results more easily by overriding the
templates.

Tested with Go 1.6, 1.7 and 1.8.

Fixes golang/go#17722

Change-Id: I3ffd25f01157f6fb7a39acd18af46f17e9c07b99
Reviewed-on: https://go-review.googlesource.com/32888
Reviewed-by: Robert Griesemer <gri@golang.org>
1 file changed