Skip to content

proposal: testing: delay registration of flags until MainStart; add Init for explicit registration #21051

Closed
@rsc

Description

@rsc

Mitchell Hashimoto pointed out at Gophercon that if you write
packages that provides extra test hooks mentioning *testing.T,
the import of "testing" forces the testing flags into any resulting
binary, even non-test binaries. At Hashicorp they define a separate
package that defines a copied testing.T interface only to avoid
these flag definitions.

I sent CL 49251 to delay the registration of the flags so that
those packages can import "testing" directly instead of a fake
package that must be kept in sync.

For discussion for Go 1.10.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions