Reject options that cannot take effect, and skip entries that are not data

This commit is contained in:
M
2026-08-28 00:17:39 +02:00
committed by lilleman-tw
parent 8d0393713c
commit b14caae3a8
4 changed files with 63 additions and 6 deletions
+3
View File
@@ -143,6 +143,9 @@ func checkTokens(format string, fields map[string]node) error {
continue // a root reference; its target is checked at New (see linkRefs)
}
if _, ok := fields[name]; !ok {
if isOption(name) {
return fmt.Errorf("token {%s}: %q is an option, never a field", t.body, name)
}
return fmt.Errorf("token {%s}: no field %q", t.body, name)
}
}