Skip to content

Commit cc99410

Browse files
moredureemersion
authored andcommitted
Use EqualFold to compare case insensitively
1 parent d0d4cef commit cc99410

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

message.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,12 @@ const (
6161
// If the flag is defined in RFC 3501, it returns the flag with the case of the
6262
// RFC. Otherwise, it returns the lowercase version of the flag.
6363
func CanonicalFlag(flag string) string {
64-
flag = strings.ToLower(flag)
6564
for _, f := range flags {
66-
if strings.ToLower(f) == flag {
65+
if strings.EqualFold(f, flag) {
6766
return f
6867
}
6968
}
70-
return flag
69+
return strings.ToLower(flag)
7170
}
7271

7372
func ParseParamList(fields []interface{}) (map[string]string, error) {

0 commit comments

Comments
 (0)