Ver código fonte

Make sure the package comment mentions all top-level messages.

At the moment, only the messages found in the first file are mentioned.
Also, sort the messages alphabetically to allow easier scanning.
Dave Day 10 anos atrás
pai
commit
6a514e697f
1 arquivos alterados com 9 adições e 5 exclusões
  1. 9 5
      protoc-gen-go/generator/generator.go

+ 9 - 5
protoc-gen-go/generator/generator.go

@@ -1125,17 +1125,21 @@ func (g *Generator) generateHeader() {
 			}
 			}
 			g.P()
 			g.P()
 		}
 		}
+		var topMsgs []string
 		g.P("It is generated from these files:")
 		g.P("It is generated from these files:")
 		for _, f := range g.genFiles {
 		for _, f := range g.genFiles {
 			g.P("\t", f.Name)
 			g.P("\t", f.Name)
+			for _, msg := range f.desc {
+				if msg.parent != nil {
+					continue
+				}
+				topMsgs = append(topMsgs, CamelCaseSlice(msg.TypeName()))
+			}
 		}
 		}
 		g.P()
 		g.P()
 		g.P("It has these top-level messages:")
 		g.P("It has these top-level messages:")
-		for _, msg := range g.file.desc {
-			if msg.parent != nil {
-				continue
-			}
-			g.P("\t", CamelCaseSlice(msg.TypeName()))
+		for _, msg := range topMsgs {
+			g.P("\t", msg)
 		}
 		}
 		g.P("*/")
 		g.P("*/")
 	}
 	}