Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 251d52b

Browse files
committed
improve comments for matchname
1 parent 1b7c3d8 commit 251d52b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mapstructure.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ type DecoderConfig struct {
260260
TagName string
261261

262262
// MatchName is the function used to match the map key to the struct
263-
// field name or tag. Defaults to `strings.EqualFold`.
263+
// field name or tag. Defaults to `strings.EqualFold`. This can be used
264+
// to implement case-sensitive tag values, support snake casing, etc.
264265
MatchName func(mapKey, fieldName string) bool
265266
}
266267

@@ -1436,6 +1437,7 @@ func (d *Decoder) matchName(mapKey, fieldName string) bool {
14361437
if d.config.MatchName != nil {
14371438
return d.config.MatchName(mapKey, fieldName)
14381439
}
1440+
14391441
return strings.EqualFold(mapKey, fieldName)
14401442
}
14411443

0 commit comments

Comments
 (0)