[stable since 2013] a lib for loading XML Schema Definition (XSD) files ➜ plus, a tool `makepkg` to code-generate from any *.xsd your Go package with all needed `struct`s to readily `xml.Unmarshal()` documents into, based on the XSD's schema definitions. NOT REALLY MAINTAINED FOR YEARS NOW: try the forks if running into issues.
In file elemmakepkg.go, line 284
if ctBaseType = bag.resolveQnameRef(ctBaseType, "T", nil); len(ctBaseType) > 0 {
td.addEmbed(nil, bag.safeName(ctBaseType))
} else if ctValueType = bag.resolveQnameRef(ctValueType, "T", nil); len(ctValueType) > 0 {
Here, ctBaseType may contain "." when the simpleContent is extended from built-in type. And when you run safeName again here, you get rid of the dot, and cause the generated file has compile error. My easy fix here is don't call safeName here, because the resolveQnameRef more like guaranteed the name is already safe. Maybe fix the implementation of safeName to whitelist "." is a better fix.
In file elemmakepkg.go, line 284 if ctBaseType = bag.resolveQnameRef(ctBaseType, "T", nil); len(ctBaseType) > 0 { td.addEmbed(nil, bag.safeName(ctBaseType)) } else if ctValueType = bag.resolveQnameRef(ctValueType, "T", nil); len(ctValueType) > 0 { Here, ctBaseType may contain "." when the simpleContent is extended from built-in type. And when you run safeName again here, you get rid of the dot, and cause the generated file has compile error. My easy fix here is don't call safeName here, because the resolveQnameRef more like guaranteed the name is already safe. Maybe fix the implementation of safeName to whitelist "." is a better fix.
You can reproduce the issue by using https://raw.githubusercontent.com/chrisdinn/vast/master/lib/vast3_draft.xsd