goprotobuf: Make text formatting of unknown enum values compatible with C++.
Also remove a registry map that isn't needed.
R=r
CC=golang-dev
https://codereview.appspot.com/9084044
diff --git a/proto/properties.go b/proto/properties.go
index 0127f72..75b3e8d 100644
--- a/proto/properties.go
+++ b/proto/properties.go
@@ -594,15 +594,13 @@
// A global registry of enum types.
// The generated code will register the generated maps by calling RegisterEnum.
-var enumNameMaps = make(map[string]map[int32]string)
var enumValueMaps = make(map[string]map[string]int32)
// RegisterEnum is called from the generated code to install the enum descriptor
-// maps into the global table to aid parsing ASCII protocol buffers.
-func RegisterEnum(typeName string, nameMap map[int32]string, valueMap map[string]int32) {
- if _, ok := enumNameMaps[typeName]; ok {
+// maps into the global table to aid parsing text format protocol buffers.
+func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) {
+ if _, ok := enumValueMaps[typeName]; ok {
panic("proto: duplicate enum registered: " + typeName)
}
- enumNameMaps[typeName] = nameMap
enumValueMaps[typeName] = valueMap
}