Skip to content

Commit

Permalink
convert caseSensitiveMatchName to a plain function
Browse files Browse the repository at this point in the history
Signed-off-by: Raphael Silva <[email protected]>
  • Loading branch information
rapphil committed Jan 11, 2023
1 parent 9323d7d commit e201ab8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions confmap/confmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func decodeConfig(m *Conf, result interface{}, errorUnused bool) error {
Result: result,
TagName: "mapstructure",
WeaklyTypedInput: true,
MatchName: caseSensitiveMatchName(),
MatchName: caseSensitiveMatchName,
DecodeHook: mapstructure.ComposeDecodeHookFunc(
expandNilStructPointersHookFunc(),
mapstructure.StringToSliceHookFunc(","),
Expand Down Expand Up @@ -193,8 +193,8 @@ func encoderConfig(rawVal interface{}) *encoder.EncoderConfig {
// case-sensitive version of the callback to be used in the MatchName property
// of the DecoderConfig. The default for MatchEqual is to use strings.EqualFold,
// which is case-insensitive.
func caseSensitiveMatchName() func(a, b string) bool {
return func(a, b string) bool { return a == b }
func caseSensitiveMatchName(a, b string) bool {
return a == b
}

// In cases where a config has a mapping of something to a struct pointers
Expand Down

0 comments on commit e201ab8

Please sign in to comment.