Skip to content

Commit

Permalink
Always export fields of structs
Browse files Browse the repository at this point in the history
This retains the ability to marshal the generated types, because only
exported fields are marshaled/unmarshaled by encoding/xml.
  • Loading branch information
mitch000001 committed Jul 10, 2016
1 parent a65655b commit 0f04795
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions gowsdl.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ func (g *GoWSDL) genTypes() ([]byte, error) {
"stripns": stripns,
"replaceReservedWords": replaceReservedWords,
"makePublic": g.makePublicFn,
"makeFieldPublic": makePublic,
"comment": comment,
"removeNS": removeNS,
}
Expand Down
6 changes: 3 additions & 3 deletions types_tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ var typesTmpl = `
{{define "Attributes"}}
{{range .}}
{{if .Doc}} {{.Doc | comment}} {{end}} {{if not .Type}}
{{ .Name | makePublic}} {{toGoType .SimpleType.Restriction.Base}} ` + "`" + `xml:"{{.Name}},attr,omitempty"` + "`" + `
{{ .Name | makeFieldPublic}} {{toGoType .SimpleType.Restriction.Base}} ` + "`" + `xml:"{{.Name}},attr,omitempty"` + "`" + `
{{else}}
{{ .Name | makePublic}} {{toGoType .Type}} ` + "`" + `xml:"{{.Name}},attr,omitempty"` + "`" + `
{{ .Name | makeFieldPublic}} {{toGoType .Type}} ` + "`" + `xml:"{{.Name}},attr,omitempty"` + "`" + `
{{end}}
{{end}}
{{end}}
Expand Down Expand Up @@ -70,7 +70,7 @@ var typesTmpl = `
{{if .Doc}}
{{.Doc | comment}} {{"\n"}}
{{end}}
{{replaceReservedWords .Name | makePublic}} {{if eq .MaxOccurs "unbounded"}}[]{{end}}{{.Type | toGoType}} ` + "`" + `xml:"{{.Name}},omitempty"` + "`" + ` {{end}}
{{replaceReservedWords .Name | makeFieldPublic}} {{if eq .MaxOccurs "unbounded"}}[]{{end}}{{.Type | toGoType}} ` + "`" + `xml:"{{.Name}},omitempty"` + "`" + ` {{end}}
{{end}}
{{end}}
{{end}}
Expand Down

0 comments on commit 0f04795

Please sign in to comment.