makeComments generates the comment string for the field, no "\n" at the end
(path string)
| 1237 | |
| 1238 | // makeComments generates the comment string for the field, no "\n" at the end |
| 1239 | func (g *Generator) makeComments(path string) (string, bool) { |
| 1240 | loc, ok := g.file.comments[path] |
| 1241 | if !ok { |
| 1242 | return "", false |
| 1243 | } |
| 1244 | w := new(bytes.Buffer) |
| 1245 | nl := "" |
| 1246 | for _, line := range strings.Split(strings.TrimSuffix(loc.GetLeadingComments(), "\n"), "\n") { |
| 1247 | fmt.Fprintf(w, "%s//%s", nl, line) |
| 1248 | nl = "\n" |
| 1249 | } |
| 1250 | return w.String(), true |
| 1251 | } |
| 1252 | |
| 1253 | func (g *Generator) fileByName(filename string) *FileDescriptor { |
| 1254 | return g.allFilesByName[filename] |
no test coverage detected