Commit b9df8df7 authored by Bryan C. Mills's avatar Bryan C. Mills

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: default avatarIan Lance Taylor <iant@golang.org>
Reviewed-by: default avatarCaleb Spare <cespare@gmail.com>
Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
parent 5e21032b
......@@ -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 -->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment