Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mapstructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -1434,8 +1434,8 @@ func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) e
if tagValue == "" && d.config.IgnoreUntaggedFields {
continue
}
tagValue = strings.SplitN(tagValue, ",", 2)[0]
if tagValue != "" {
tagValue, _, _ = strings.Cut(tagValue, ",")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change breaks the behavior of a tag without a name: https://go.dev/play/p/Hu0LR1FDKqi
strings.SplitN or strings.Cut should be out of an if block.

fieldName = tagValue
}

Expand Down