#60737 suggests adding const Testing bool = ... to package testing, unaware of #52600 that added func() Testing bool.
This proposal is a replacement for #60737 to discuss whether the new API should return a compile-time constant (right now the result is filled in at link time), so that packages can compile differently when being built as a dependency of a test.
Specifically, package testing would itself build differently when built as a dependency of a test versus a non-test binary, and then any packages that import "testing" in non-test code would then also have to rebuild. So if A imports B imports C imports testing, and A also imports D, and we are building A's test, we have to rebuild testing, C, B for A's test, but not D.
The rebuild is the only cost here. The potential problems with abuse of testing.Testing are the same either way.
#60737 suggests adding
const Testing bool = ...to package testing, unaware of #52600 that addedfunc() Testing bool.This proposal is a replacement for #60737 to discuss whether the new API should return a compile-time constant (right now the result is filled in at link time), so that packages can compile differently when being built as a dependency of a test.
Specifically, package testing would itself build differently when built as a dependency of a test versus a non-test binary, and then any packages that import "testing" in non-test code would then also have to rebuild. So if A imports B imports C imports testing, and A also imports D, and we are building A's test, we have to rebuild testing, C, B for A's test, but not D.
The rebuild is the only cost here. The potential problems with abuse of testing.Testing are the same either way.