Просмотр исходного кода

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 лет назад
Родитель
Сommit
6a514e697f
1 измененных файлов с 9 добавлено и 5 удалено
  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()
 		}
+		var topMsgs []string
 		g.P("It is generated from these files:")
 		for _, f := range g.genFiles {
 			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("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("*/")
 	}