mirror of
https://github.com/golang/go.git
synced 2024-09-21 10:28:27 +00:00
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><!-- 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.
|
||||
<p>
|
||||
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 flag definition
|
||||
(via <a href="/pkg/flag/#Bool"><code>Bool</code></a>,
|
||||
<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>
|
||||
</dd>
|
||||
</dl><!-- flag -->
|
||||
|
Loading…
Reference in New Issue
Block a user