internal/filetype, internal/filedesc: avoid gccgo bug

Returning an anonymous struct is tickling a gccgo bug:
https://github.com/golang/go/issues/33866

Change to a named type. We could make the type unexpoerted, but this is
an internal package anyway so leave it exported for general style
cleanliness.

Change-Id: Idf33f1e354c0e07066ab68640308af1498a01447
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/191960
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/internal/filedesc/build.go b/internal/filedesc/build.go
index 916b89a..3719455 100644
--- a/internal/filedesc/build.go
+++ b/internal/filedesc/build.go
@@ -65,13 +65,8 @@
 	listMethOutDeps
 )
 
-// Build constructs a FileDescriptor given the parameters set in Builder.
-// It assumes that the inputs are well-formed and panics if any inconsistencies
-// are encountered.
-//
-// If NumEnums+NumMessages+NumExtensions+NumServices is zero,
-// then Build automatically derives them from the raw descriptor.
-func (db Builder) Build() (out struct {
+// Out is the output of the Builder.
+type Out struct {
 	File pref.FileDescriptor
 
 	// Enums is all enum descriptors in "flattened ordering".
@@ -83,7 +78,15 @@
 	Extensions []Extension
 	// Service is all service descriptors in "flattened ordering".
 	Services []Service
-}) {
+}
+
+// Build constructs a FileDescriptor given the parameters set in Builder.
+// It assumes that the inputs are well-formed and panics if any inconsistencies
+// are encountered.
+//
+// If NumEnums+NumMessages+NumExtensions+NumServices is zero,
+// then Build automatically derives them from the raw descriptor.
+func (db Builder) Build() (out Out) {
 	// Populate the counts if uninitialized.
 	if db.NumEnums+db.NumMessages+db.NumExtensions+db.NumServices == 0 {
 		db.unmarshalCounts(db.RawDescriptor, true)
diff --git a/internal/filetype/build.go b/internal/filetype/build.go
index 965ff27..b89a688 100644
--- a/internal/filetype/build.go
+++ b/internal/filetype/build.go
@@ -112,9 +112,12 @@
 	}
 }
 
-func (tb Builder) Build() (out struct {
+// Out is the output of the builder.
+type Out struct {
 	File pref.FileDescriptor
-}) {
+}
+
+func (tb Builder) Build() (out Out) {
 	// Replace the resolver with one that resolves dependencies by index,
 	// which is faster and more reliable than relying on the global registry.
 	if tb.File.FileRegistry == nil {