Decoder: allow commas in tags (#693)

This commit is contained in:
Thomas Pelletier
2021-11-30 21:59:22 -05:00
committed by GitHub
parent 0d20a84523
commit c862c344b3
2 changed files with 37 additions and 2 deletions
+9 -2
View File
@@ -1163,8 +1163,15 @@ func forEachField(t reflect.Type, path []int, do func(name string, path []int))
continue
}
name, ok := f.Tag.Lookup("toml")
if !ok {
name := f.Tag.Get("toml")
if name == "-" {
continue
}
if i := strings.IndexByte(name, ','); i >= 0 {
name = name[:i]
}
if name == "" {
name = f.Name
}