Skip to content

Commit c78f730

Browse files
authored
Merge pull request #261 from dubrie/master
Switching from whitelist to Allowlist terminology. Fixes #294
2 parents c2fd743 + 0aa4171 commit c78f730

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

flag.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ const (
137137
PanicOnError
138138
)
139139

140-
// ParseErrorsWhitelist defines the parsing errors that can be ignored
141-
type ParseErrorsWhitelist struct {
140+
// ParseErrorsAllowlist defines the parsing errors that can be ignored
141+
type ParseErrorsAllowlist struct {
142142
// UnknownFlags will ignore unknown flags errors and continue parsing rest of the flags
143143
UnknownFlags bool
144144
}
@@ -158,8 +158,8 @@ type FlagSet struct {
158158
// help/usage messages.
159159
SortFlags bool
160160

161-
// ParseErrorsWhitelist is used to configure a whitelist of errors
162-
ParseErrorsWhitelist ParseErrorsWhitelist
161+
// ParseErrorsAllowlist is used to configure an allowlist of errors
162+
ParseErrorsAllowlist ParseErrorsAllowlist
163163

164164
name string
165165
parsed bool
@@ -984,7 +984,7 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
984984
case name == "help":
985985
f.usage()
986986
return a, ErrHelp
987-
case f.ParseErrorsWhitelist.UnknownFlags:
987+
case f.ParseErrorsAllowlist.UnknownFlags:
988988
// --unknown=unknownval arg ...
989989
// we do not want to lose arg in this case
990990
if len(split) >= 2 {
@@ -1042,7 +1042,7 @@ func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parse
10421042
f.usage()
10431043
err = ErrHelp
10441044
return
1045-
case f.ParseErrorsWhitelist.UnknownFlags:
1045+
case f.ParseErrorsAllowlist.UnknownFlags:
10461046
// '-f=arg arg ...'
10471047
// we do not want to lose arg in this case
10481048
if len(shorthands) > 2 && shorthands[1] == '=' {

flag_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ func testParseWithUnknownFlags(f *FlagSet, t *testing.T) {
451451
if f.Parsed() {
452452
t.Error("f.Parse() = true before Parse")
453453
}
454-
f.ParseErrorsWhitelist.UnknownFlags = true
454+
f.ParseErrorsAllowlist.UnknownFlags = true
455455

456456
f.BoolP("boola", "a", false, "bool value")
457457
f.BoolP("boolb", "b", false, "bool2 value")

0 commit comments

Comments
 (0)