| Index: mojom/generators/go/templates/templates.go
|
| diff --git a/mojom/generators/go/templates/templates.go b/mojom/generators/go/templates/templates.go
|
| index fd725af0d305aec6ebf1b66bb08b48c4756a5b1a..080a93c75085dfbd27fc7e8c387d8c7685a6cc41 100644
|
| --- a/mojom/generators/go/templates/templates.go
|
| +++ b/mojom/generators/go/templates/templates.go
|
| @@ -34,16 +34,13 @@ func ExecuteTemplates(tmplFile *translator.TmplFile) string {
|
| func init() {
|
| // We parse the subtemplates only once.
|
| goFileTmpl = template.New("GoFileTemplate")
|
| +
|
| template.Must(goFileTmpl.Parse(goFileTemplate))
|
| - template.Must(goFileTmpl.Parse(nonNullableFieldDecodingTmplText))
|
| - template.Must(goFileTmpl.Parse(fieldDecodingTmplText))
|
|
|
| - template.Must(goFileTmpl.Parse(nonNullableFieldEncodingTmplText))
|
| - template.Must(goFileTmpl.Parse(fieldEncodingTmplText))
|
| - template.Must(goFileTmpl.Parse(structEncodingTmplText))
|
| - template.Must(goFileTmpl.Parse(structDeclTmplText))
|
| - template.Must(goFileTmpl.Parse(structVersions))
|
| - template.Must(goFileTmpl.Parse(structDecodingTmplText))
|
| + initEncodingTemplates()
|
| + initDecodingTemplates()
|
| + initStructTemplates()
|
| + initUnionTemplates()
|
| }
|
|
|
| const goFileTemplate = `
|
| @@ -58,13 +55,11 @@ import (
|
| )
|
|
|
| {{- range $struct := $fileTmpl.Structs}}
|
| - {{ template "StructDecl" $struct }}
|
| -
|
| - {{ template "StructEncodingTmpl" $struct }}
|
| -
|
| - {{ template "StructVersions" $struct }}
|
| + {{ template "Struct" $struct }}
|
| +{{- end}}
|
|
|
| - {{ template "StructDecodingTmpl" $struct }}
|
| +{{- range $union := $fileTmpl.Unions}}
|
| + {{ template "Union" $union }}
|
| {{- end}}
|
| {{- end -}}
|
| `
|
|
|