generateMessageStruct adds the actual struct with it's members (but not methods) to the output.
(mc *msgCtx, topLevelFields []topLevelField)
| 2074 | |
| 2075 | // generateMessageStruct adds the actual struct with it's members (but not methods) to the output. |
| 2076 | func (g *Generator) generateMessageStruct(mc *msgCtx, topLevelFields []topLevelField) { |
| 2077 | comments := g.PrintComments(mc.message.path) |
| 2078 | |
| 2079 | // Guarantee deprecation comments appear after user-provided comments. |
| 2080 | if mc.message.GetOptions().GetDeprecated() { |
| 2081 | if comments { |
| 2082 | // Convention: Separate deprecation comments from original |
| 2083 | // comments with an empty line. |
| 2084 | g.P("//") |
| 2085 | } |
| 2086 | g.P(deprecationComment) |
| 2087 | } |
| 2088 | |
| 2089 | g.P("type ", Annotate(mc.message.file, mc.message.path, mc.goName), " struct {") |
| 2090 | for _, pf := range topLevelFields { |
| 2091 | pf.decl(g, mc) |
| 2092 | } |
| 2093 | g.generateInternalStructFields(mc, topLevelFields) |
| 2094 | g.P("}") |
| 2095 | } |
| 2096 | |
| 2097 | // generateGetters adds getters for all fields, including oneofs and weak fields when applicable. |
| 2098 | func (g *Generator) generateGetters(mc *msgCtx, topLevelFields []topLevelField) { |
no test coverage detected