mirror of https://github.com/golang/go.git
doc/go1.21: reformat flag init change note
It reads better as a single paragraph. Also added links. Change-Id: Id6ba54111b63fbd536423272f674e0eb64b087a7 Reviewed-on: https://go-review.googlesource.com/c/go/+/499956 TryBot-Bypass: Ian Lance Taylor <iant@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
fecb31f672
commit
990113f3a0
|
|
@ -568,9 +568,19 @@ Do not send CLs removing the interior tags from such phrases.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p><!-- CL 480215 -->
|
<p><!-- CL 480215 -->
|
||||||
A flag definition (via <code>Bool</code>, <code>BoolVar</code>, <code>Int</code>, <code>IntVar</code>, etc.) will panic if <code>Set</code> has already been called on a flag with the same name.
|
A flag definition
|
||||||
<p>
|
(via <a href="/pkg/flag/#Bool"><code>Bool</code></a>,
|
||||||
This change is intended to detect cases where <a href="#language">changes in initialization order</a> cause flag operations to occur in a different order than expected. In many cases the fix to this problem is to introduce a explicit package dependence to correctly order the definition before any <code>Set</code> operations.
|
<a href="/pkg/flag/#BoolVar"><code>BoolVar</code></a>,
|
||||||
|
<a href="/pkg/flag/#Int"><code>Int</code></a>,
|
||||||
|
<a href="/pkg/flag/#IntVar"><code>IntVar</code></a>, etc.)
|
||||||
|
will panic if <a href="/pkg/flag/#Set"><code>Set</code></a> has
|
||||||
|
already been called on a flag with the same name. This change is
|
||||||
|
intended to detect cases where <a href="#language">changes in
|
||||||
|
initialization order</a> cause flag operations to occur in a
|
||||||
|
different order than expected. In many cases the fix to this
|
||||||
|
problem is to introduce a explicit package dependence to
|
||||||
|
correctly order the definition before any
|
||||||
|
<a href="/pkg/flag/#Set"><code>Set</code></a> operations.
|
||||||
</p>
|
</p>
|
||||||
</dd>
|
</dd>
|
||||||
</dl><!-- flag -->
|
</dl><!-- flag -->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue