protogen: use full filename in per-file vars

For a file "foo/bar.proto", put the FileDescriptor in "ProtoFile_foo_bar"
rather than "Bar_fileDescriptor".

Avoid name clashes when a package contains "a/foo.proto" and "b/foo.proto".

Don't camelcase the filename: These vars weren't fully camelcased to begin
with, and leaving the filename relatively unchanged is clearer and more
predictable.

Move "ProtoFile" from the end of the var name to the start, so that vars
will sort better in packages with multiple descriptors.

These changes do add a chance of name collision when the input filename
begins with an uppercase letter: Foo.proto becomes "ProtoFile_Foo", which
could be the result of camelcasing "proto_file.foo". The readability
benefits seem worth it.

Change-Id: If27d3a0d7b5bf3535aa1607a8579eb057c74d2dc
Reviewed-on: https://go-review.googlesource.com/c/163199
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/internal/testprotos/test/test_public.pb.go b/internal/testprotos/test/test_public.pb.go
index b316027..f4e78e0 100644
--- a/internal/testprotos/test/test_public.pb.go
+++ b/internal/testprotos/test/test_public.pb.go
@@ -25,7 +25,7 @@
 }
 
 func (m *PublicImportMessage) ProtoReflect() protoreflect.Message {
-	return xxx_TestPublic_protoFile_messageTypes[0].MessageOf(m)
+	return xxx_ProtoFile_test_public_messageTypes[0].MessageOf(m)
 }
 func (m *PublicImportMessage) Reset()         { *m = PublicImportMessage{} }
 func (m *PublicImportMessage) String() string { return proto.CompactTextString(m) }
@@ -79,27 +79,27 @@
 
 const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
 
-var TestPublic_protoFile protoreflect.FileDescriptor
+var ProtoFile_test_public protoreflect.FileDescriptor
 
-var xxx_TestPublic_protoFile_messageTypes [1]protoimpl.MessageType
-var xxx_TestPublic_protoFile_goTypes = []interface{}{
+var xxx_ProtoFile_test_public_messageTypes [1]protoimpl.MessageType
+var xxx_ProtoFile_test_public_goTypes = []interface{}{
 	(*PublicImportMessage)(nil), // 0: goproto.proto.test.PublicImportMessage
 }
-var xxx_TestPublic_protoFile_depIdxs = []int32{}
+var xxx_ProtoFile_test_public_depIdxs = []int32{}
 
 func init() {
 	var messageTypes [1]protoreflect.MessageType
-	TestPublic_protoFile = protoimpl.FileBuilder{
+	ProtoFile_test_public = protoimpl.FileBuilder{
 		RawDescriptor:      fileDescriptor_36dd44afd5b47374,
-		GoTypes:            xxx_TestPublic_protoFile_goTypes,
-		DependencyIndexes:  xxx_TestPublic_protoFile_depIdxs,
+		GoTypes:            xxx_ProtoFile_test_public_goTypes,
+		DependencyIndexes:  xxx_ProtoFile_test_public_depIdxs,
 		MessageOutputTypes: messageTypes[:],
 	}.Init()
-	messageGoTypes := xxx_TestPublic_protoFile_goTypes[0:][:1]
+	messageGoTypes := xxx_ProtoFile_test_public_goTypes[0:][:1]
 	for i, mt := range messageTypes[:] {
-		xxx_TestPublic_protoFile_messageTypes[i].GoType = reflect.TypeOf(messageGoTypes[i])
-		xxx_TestPublic_protoFile_messageTypes[i].PBType = mt
+		xxx_ProtoFile_test_public_messageTypes[i].GoType = reflect.TypeOf(messageGoTypes[i])
+		xxx_ProtoFile_test_public_messageTypes[i].PBType = mt
 	}
-	xxx_TestPublic_protoFile_goTypes = nil
-	xxx_TestPublic_protoFile_depIdxs = nil
+	xxx_ProtoFile_test_public_goTypes = nil
+	xxx_ProtoFile_test_public_depIdxs = nil
 }