feat: honour the omitzero and omitempty tag options on encode

Assisted-by: GLM 5.3 Flash
This commit is contained in:
2026-09-17 19:57:23 +02:00
parent 58e7dfb1d0
commit 93c36cf376
6 changed files with 160 additions and 4 deletions
+1 -1
View File
@@ -230,7 +230,7 @@ func structFields(t reflect.Type) map[string]int {
}
name := f.Name
if tag, ok := f.Tag.Lookup("toml"); ok {
tag = strings.Split(tag, ",")[0]
tag, _, _ = strings.Cut(tag, ",")
if tag == "-" {
continue
}