@@ -143,6 +143,10 @@ type ParseErrorsAllowlist struct {
143
143
UnknownFlags bool
144
144
}
145
145
146
+ // DEPRECATED: please use ParseErrorsAllowlist instead
147
+ // This type will be removed in a future release
148
+ type ParseErrorsWhitelist = ParseErrorsAllowlist
149
+
146
150
// NormalizedName is a flag name that has been normalized according to rules
147
151
// for the FlagSet (e.g. making '-' and '_' equivalent).
148
152
type NormalizedName string
@@ -161,6 +165,10 @@ type FlagSet struct {
161
165
// ParseErrorsAllowlist is used to configure an allowlist of errors
162
166
ParseErrorsAllowlist ParseErrorsAllowlist
163
167
168
+ // DEPRECATED: please use ParseErrorsAllowlist instead
169
+ // This field will be removed in a future release
170
+ ParseErrorsWhitelist ParseErrorsAllowlist
171
+
164
172
name string
165
173
parsed bool
166
174
actual map [NormalizedName ]* Flag
@@ -984,6 +992,8 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
984
992
case name == "help" :
985
993
f .usage ()
986
994
return a , ErrHelp
995
+ case f .ParseErrorsWhitelist .UnknownFlags :
996
+ fallthrough
987
997
case f .ParseErrorsAllowlist .UnknownFlags :
988
998
// --unknown=unknownval arg ...
989
999
// we do not want to lose arg in this case
@@ -1042,6 +1052,8 @@ func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parse
1042
1052
f .usage ()
1043
1053
err = ErrHelp
1044
1054
return
1055
+ case f .ParseErrorsWhitelist .UnknownFlags :
1056
+ fallthrough
1045
1057
case f .ParseErrorsAllowlist .UnknownFlags :
1046
1058
// '-f=arg arg ...'
1047
1059
// we do not want to lose arg in this case
0 commit comments