Sync test2json from upstream Go (#4261)

Sync test2json from upstream Go. All the code changes are from
golang/go. Only the comment was changed by this PR.

I tried to do that in #4250, but was blocked by a flaky test that was
fixed in #4257. Retrying...
1 file changed