1
0
mirror of https://github.com/golang/go synced 2024-11-23 00:50:05 -07:00

doc/go1.13: mention the effect of testing.Init on package initialization

Fixes #31859

Change-Id: I228ed93f9466d1a22f8796964f5d2f056ab9b62f
Reviewed-on: https://go-review.googlesource.com/c/go/+/186818
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Caleb Spare <cespare@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
This commit is contained in:
Bryan C. Mills 2019-07-18 17:41:45 -04:00
parent 5e21032b3d
commit b9df8df70f

View File

@ -841,8 +841,10 @@ godoc
</p>
<p><!-- CL 173722 -->
Testing flags are now registered in the new <a href="/pkg/testing/#Init"><code>Init</code></a> function.
As a result, testing flags are now only registered when running a test binary.
Testing flags are now registered in the new <a href="/pkg/testing/#Init"><code>Init</code></a> function,
which is invoked by the generated <code>main</code> function for the test.
As a result, testing flags are now only registered when running a test binary,
and packages that call <code>flag.Parse</code> during package initialization may cause tests to fail.
</p>
</dl><!-- testing -->