From: Keith Randall
Date: Tue, 30 May 2023 17:54:21 +0000 (-0700)
Subject: doc: document new panic behavior of flag definition after Set
X-Git-Tag: go1.21rc1~176
X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=094c75219a160be1667c9757f363ffad8926632b;p=gostls13.git
doc: document new panic behavior of flag definition after Set
For #57411
Change-Id: I56c112bb03dde24c2e2643c9b72ce06158a8e717
Reviewed-on: https://go-review.googlesource.com/c/go/+/499278
TryBot-Bypass: Keith Randall
Reviewed-by: Ian Lance Taylor
Reviewed-by: Keith Randall
---
diff --git a/doc/go1.21.html b/doc/go1.21.html
index 085b81dbf7..e08f84c384 100644
--- a/doc/go1.21.html
+++ b/doc/go1.21.html
@@ -456,7 +456,9 @@ Do not send CLs removing the interior tags from such phrases.
- TODO: https://go.dev/cl/480215: flag: panic if a flag is defined after being set
+ A flag definition (via Bool
, BoolVar
, Int
, IntVar
, etc.) will panic if Set
has already been called on a flag with the same name.
+
+ This change is intended to detect cases where changes in initialization order 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 Set
operations.