Преглед на файлове

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 преди 11 години
родител
ревизия
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("*/")
 	}