type newType … func generateDoc(out *bytes.Buffer, doc string) { … } // decide if a property is optional, and if it needs a * // return ",omitempty" if it is optional, and "*" if it needs a pointer func propStar(name string, t NameType, gotype string) (string, string) { … } func goName(s string) string { … }