소스 검색

vendor: Update github.com/gogo/protobuf

Also tweaks the proto definitions:

 - [packed=false] on the block_indexes field to retain compat with
   v0.14.16 and earlier.

 - Uses the vendored protobuf package in include paths.

And, "build.go setup" will install the vendored protoc-gen-gogofast.
This should ensure that a proto rebuild isn't so dependent on whatever
version of the compiler and package the developer has installed...

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3864
Jakob Borg 8 년 전
부모
커밋
987718baf8
100개의 변경된 파일12169개의 추가작업 그리고 1398개의 파일을 삭제
  1. 2 0
      build.go
  2. 1 1
      lib/db/structs.go
  3. 168 159
      lib/db/structs.pb.go
  4. 1 1
      lib/db/structs.proto
  5. 1 1
      lib/discover/local.go
  6. 69 64
      lib/discover/local.pb.go
  7. 256 254
      lib/protocol/bep.pb.go
  8. 1 3
      lib/protocol/bep.proto
  9. 1 1
      lib/protocol/bep_extensions.go
  10. 1 1
      lib/protocol/deviceid_test.go
  11. 66 62
      lib/protocol/deviceid_test.pb.go
  12. 3 0
      vendor/github.com/gogo/protobuf/.gitignore
  13. 8 0
      vendor/github.com/gogo/protobuf/.mailmap
  14. 25 0
      vendor/github.com/gogo/protobuf/.travis.yml
  15. 14 0
      vendor/github.com/gogo/protobuf/AUTHORS
  16. 16 0
      vendor/github.com/gogo/protobuf/CONTRIBUTORS
  17. 5 0
      vendor/github.com/gogo/protobuf/GOLANG_CONTRIBUTORS
  18. 3 3
      vendor/github.com/gogo/protobuf/LICENSE
  19. 141 0
      vendor/github.com/gogo/protobuf/Makefile
  20. 258 0
      vendor/github.com/gogo/protobuf/README
  21. 116 0
      vendor/github.com/gogo/protobuf/Readme.md
  22. 40 0
      vendor/github.com/gogo/protobuf/_conformance/Makefile
  23. 161 0
      vendor/github.com/gogo/protobuf/_conformance/conformance.go
  24. 1890 0
      vendor/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.pb.go
  25. 285 0
      vendor/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.proto
  26. 190 0
      vendor/github.com/gogo/protobuf/bench.md
  27. 4 2
      vendor/github.com/gogo/protobuf/codec/codec.go
  28. 54 0
      vendor/github.com/gogo/protobuf/codec/codec_test.go
  29. 167 0
      vendor/github.com/gogo/protobuf/extensions.md
  30. 37 0
      vendor/github.com/gogo/protobuf/gogoproto/Makefile
  31. 3 3
      vendor/github.com/gogo/protobuf/gogoproto/doc.go
  32. 159 71
      vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go
  33. 45 0
      vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden
  34. 125 0
      vendor/github.com/gogo/protobuf/gogoproto/gogo.proto
  35. 38 1
      vendor/github.com/gogo/protobuf/gogoproto/helper.go
  36. 25 0
      vendor/github.com/gogo/protobuf/gogoreplace/main.go
  37. 29 0
      vendor/github.com/gogo/protobuf/install-protobuf.sh
  38. 3 3
      vendor/github.com/gogo/protobuf/io/full.go
  39. 3 3
      vendor/github.com/gogo/protobuf/io/io.go
  40. 221 0
      vendor/github.com/gogo/protobuf/io/io_test.go
  41. 3 3
      vendor/github.com/gogo/protobuf/io/uint32.go
  42. 3 3
      vendor/github.com/gogo/protobuf/io/varint.go
  43. 421 70
      vendor/github.com/gogo/protobuf/jsonpb/jsonpb.go
  44. 558 0
      vendor/github.com/gogo/protobuf/jsonpb/jsonpb_test.go
  45. 33 0
      vendor/github.com/gogo/protobuf/jsonpb/jsonpb_test_proto/Makefile
  46. 7 0
      vendor/github.com/gogo/protobuf/jsonpb/jsonpb_test_proto/bytes.go
  47. 112 25
      vendor/github.com/gogo/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.pb.go
  48. 57 0
      vendor/github.com/gogo/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.proto
  49. 267 69
      vendor/github.com/gogo/protobuf/jsonpb/jsonpb_test_proto/test_objects.pb.go
  50. 138 0
      vendor/github.com/gogo/protobuf/jsonpb/jsonpb_test_proto/test_objects.proto
  51. 14 8
      vendor/github.com/gogo/protobuf/plugin/compare/compare.go
  52. 5 3
      vendor/github.com/gogo/protobuf/plugin/compare/comparetest.go
  53. 3 1
      vendor/github.com/gogo/protobuf/plugin/defaultcheck/defaultcheck.go
  54. 3 1
      vendor/github.com/gogo/protobuf/plugin/description/description.go
  55. 3 1
      vendor/github.com/gogo/protobuf/plugin/description/descriptiontest.go
  56. 3 1
      vendor/github.com/gogo/protobuf/plugin/embedcheck/embedcheck.go
  57. 4 2
      vendor/github.com/gogo/protobuf/plugin/enumstringer/enumstringer.go
  58. 55 12
      vendor/github.com/gogo/protobuf/plugin/equal/equal.go
  59. 5 3
      vendor/github.com/gogo/protobuf/plugin/equal/equaltest.go
  60. 3 1
      vendor/github.com/gogo/protobuf/plugin/face/face.go
  61. 3 1
      vendor/github.com/gogo/protobuf/plugin/face/facetest.go
  62. 18 10
      vendor/github.com/gogo/protobuf/plugin/gostring/gostring.go
  63. 3 1
      vendor/github.com/gogo/protobuf/plugin/gostring/gostringtest.go
  64. 225 125
      vendor/github.com/gogo/protobuf/plugin/marshalto/marshalto.go
  65. 3 1
      vendor/github.com/gogo/protobuf/plugin/oneofcheck/oneofcheck.go
  66. 62 40
      vendor/github.com/gogo/protobuf/plugin/populate/populate.go
  67. 88 18
      vendor/github.com/gogo/protobuf/plugin/size/size.go
  68. 6 4
      vendor/github.com/gogo/protobuf/plugin/size/sizetest.go
  69. 6 3
      vendor/github.com/gogo/protobuf/plugin/stringer/stringer.go
  70. 3 1
      vendor/github.com/gogo/protobuf/plugin/stringer/stringertest.go
  71. 36 34
      vendor/github.com/gogo/protobuf/plugin/testgen/testgen.go
  72. 3 1
      vendor/github.com/gogo/protobuf/plugin/union/union.go
  73. 3 1
      vendor/github.com/gogo/protobuf/plugin/union/uniontest.go
  74. 194 74
      vendor/github.com/gogo/protobuf/plugin/unmarshal/unmarshal.go
  75. 0 36
      vendor/github.com/gogo/protobuf/proto/LICENSE
  76. 43 0
      vendor/github.com/gogo/protobuf/proto/Makefile
  77. 2278 0
      vendor/github.com/gogo/protobuf/proto/all_test.go
  78. 300 0
      vendor/github.com/gogo/protobuf/proto/any_test.go
  79. 10 4
      vendor/github.com/gogo/protobuf/proto/clone.go
  80. 300 0
      vendor/github.com/gogo/protobuf/proto/clone_test.go
  81. 126 20
      vendor/github.com/gogo/protobuf/proto/decode.go
  82. 7 4
      vendor/github.com/gogo/protobuf/proto/decode_gogo.go
  83. 260 0
      vendor/github.com/gogo/protobuf/proto/decode_test.go
  84. 100 0
      vendor/github.com/gogo/protobuf/proto/duration.go
  85. 203 0
      vendor/github.com/gogo/protobuf/proto/duration_gogo.go
  86. 59 22
      vendor/github.com/gogo/protobuf/proto/encode.go
  87. 9 13
      vendor/github.com/gogo/protobuf/proto/encode_gogo.go
  88. 82 0
      vendor/github.com/gogo/protobuf/proto/encode_test.go
  89. 29 5
      vendor/github.com/gogo/protobuf/proto/equal.go
  90. 224 0
      vendor/github.com/gogo/protobuf/proto/equal_test.go
  91. 294 119
      vendor/github.com/gogo/protobuf/proto/extensions.go
  92. 73 15
      vendor/github.com/gogo/protobuf/proto/extensions_gogo.go
  93. 538 0
      vendor/github.com/gogo/protobuf/proto/extensions_test.go
  94. 5 1
      vendor/github.com/gogo/protobuf/proto/lib.go
  95. 4 2
      vendor/github.com/gogo/protobuf/proto/lib_gogo.go
  96. 46 0
      vendor/github.com/gogo/protobuf/proto/map_test.go
  97. 37 6
      vendor/github.com/gogo/protobuf/proto/message_set.go
  98. 66 0
      vendor/github.com/gogo/protobuf/proto/message_set_test.go
  99. 6 1
      vendor/github.com/gogo/protobuf/proto/pointer_reflect.go
  100. 85 0
      vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go

+ 2 - 0
build.go

@@ -400,6 +400,8 @@ func setup() {
 		fmt.Println(pkg)
 		fmt.Println(pkg)
 		runPrint("go", "get", "-u", pkg)
 		runPrint("go", "get", "-u", pkg)
 	}
 	}
+
+	runPrint("go", "install", "-v", "./vendor/github.com/gogo/protobuf/protoc-gen-gogofast")
 }
 }
 
 
 func test(pkgs ...string) {
 func test(pkgs ...string) {

+ 1 - 1
lib/db/structs.go

@@ -5,7 +5,7 @@
 // You can obtain one at http://mozilla.org/MPL/2.0/.
 // You can obtain one at http://mozilla.org/MPL/2.0/.
 
 
 //go:generate go run ../../script/protofmt.go structs.proto
 //go:generate go run ../../script/protofmt.go structs.proto
-//go:generate protoc -I ../../../../../ -I ../../../../gogo/protobuf/protobuf -I . --gogofast_out=. structs.proto
+//go:generate protoc -I ../../../../../ -I ../../vendor/ -I ../../vendor/github.com/gogo/protobuf/protobuf -I . --gogofast_out=. structs.proto
 
 
 package db
 package db
 
 

+ 168 - 159
lib/db/structs.pb.go

@@ -21,6 +21,8 @@ import math "math"
 import _ "github.com/gogo/protobuf/gogoproto"
 import _ "github.com/gogo/protobuf/gogoproto"
 import protocol "github.com/syncthing/syncthing/lib/protocol"
 import protocol "github.com/syncthing/syncthing/lib/protocol"
 
 
+import github_com_syncthing_syncthing_lib_protocol "github.com/syncthing/syncthing/lib/protocol"
+
 import io "io"
 import io "io"
 
 
 // Reference imports to suppress errors if they are not otherwise used.
 // Reference imports to suppress errors if they are not otherwise used.
@@ -30,7 +32,9 @@ var _ = math.Inf
 
 
 // This is a compile-time assertion to ensure that this generated file
 // This is a compile-time assertion to ensure that this generated file
 // is compatible with the proto package it is being compiled against.
 // is compatible with the proto package it is being compiled against.
-const _ = proto.GoGoProtoPackageIsVersion1
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
 
 
 type FileVersion struct {
 type FileVersion struct {
 	Version protocol.Vector `protobuf:"bytes,1,opt,name=version" json:"version"`
 	Version protocol.Vector `protobuf:"bytes,1,opt,name=version" json:"version"`
@@ -52,19 +56,19 @@ func (*VersionList) Descriptor() ([]byte, []int) { return fileDescriptorStructs,
 
 
 // Must be the same as FileInfo but without the blocks field
 // Must be the same as FileInfo but without the blocks field
 type FileInfoTruncated struct {
 type FileInfoTruncated struct {
-	Name          string                `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
-	Type          protocol.FileInfoType `protobuf:"varint,2,opt,name=type,proto3,enum=protocol.FileInfoType" json:"type,omitempty"`
-	Size          int64                 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`
-	Permissions   uint32                `protobuf:"varint,4,opt,name=permissions,proto3" json:"permissions,omitempty"`
-	ModifiedS     int64                 `protobuf:"varint,5,opt,name=modified_s,json=modifiedS,proto3" json:"modified_s,omitempty"`
-	ModifiedNs    int32                 `protobuf:"varint,11,opt,name=modified_ns,json=modifiedNs,proto3" json:"modified_ns,omitempty"`
-	ModifiedBy    protocol.ShortID      `protobuf:"varint,12,opt,name=modified_by,json=modifiedBy,proto3,customtype=protocol.ShortID" json:"modified_by"`
-	Deleted       bool                  `protobuf:"varint,6,opt,name=deleted,proto3" json:"deleted,omitempty"`
-	Invalid       bool                  `protobuf:"varint,7,opt,name=invalid,proto3" json:"invalid,omitempty"`
-	NoPermissions bool                  `protobuf:"varint,8,opt,name=no_permissions,json=noPermissions,proto3" json:"no_permissions,omitempty"`
-	Version       protocol.Vector       `protobuf:"bytes,9,opt,name=version" json:"version"`
-	Sequence      int64                 `protobuf:"varint,10,opt,name=sequence,proto3" json:"sequence,omitempty"`
-	SymlinkTarget string                `protobuf:"bytes,17,opt,name=symlink_target,json=symlinkTarget,proto3" json:"symlink_target,omitempty"`
+	Name          string                                              `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+	Type          protocol.FileInfoType                               `protobuf:"varint,2,opt,name=type,proto3,enum=protocol.FileInfoType" json:"type,omitempty"`
+	Size          int64                                               `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`
+	Permissions   uint32                                              `protobuf:"varint,4,opt,name=permissions,proto3" json:"permissions,omitempty"`
+	ModifiedS     int64                                               `protobuf:"varint,5,opt,name=modified_s,json=modifiedS,proto3" json:"modified_s,omitempty"`
+	ModifiedNs    int32                                               `protobuf:"varint,11,opt,name=modified_ns,json=modifiedNs,proto3" json:"modified_ns,omitempty"`
+	ModifiedBy    github_com_syncthing_syncthing_lib_protocol.ShortID `protobuf:"varint,12,opt,name=modified_by,json=modifiedBy,proto3,customtype=github.com/syncthing/syncthing/lib/protocol.ShortID" json:"modified_by"`
+	Deleted       bool                                                `protobuf:"varint,6,opt,name=deleted,proto3" json:"deleted,omitempty"`
+	Invalid       bool                                                `protobuf:"varint,7,opt,name=invalid,proto3" json:"invalid,omitempty"`
+	NoPermissions bool                                                `protobuf:"varint,8,opt,name=no_permissions,json=noPermissions,proto3" json:"no_permissions,omitempty"`
+	Version       protocol.Vector                                     `protobuf:"bytes,9,opt,name=version" json:"version"`
+	Sequence      int64                                               `protobuf:"varint,10,opt,name=sequence,proto3" json:"sequence,omitempty"`
+	SymlinkTarget string                                              `protobuf:"bytes,17,opt,name=symlink_target,json=symlinkTarget,proto3" json:"symlink_target,omitempty"`
 }
 }
 
 
 func (m *FileInfoTruncated) Reset()                    { *m = FileInfoTruncated{} }
 func (m *FileInfoTruncated) Reset()                    { *m = FileInfoTruncated{} }
@@ -76,59 +80,59 @@ func init() {
 	proto.RegisterType((*VersionList)(nil), "db.VersionList")
 	proto.RegisterType((*VersionList)(nil), "db.VersionList")
 	proto.RegisterType((*FileInfoTruncated)(nil), "db.FileInfoTruncated")
 	proto.RegisterType((*FileInfoTruncated)(nil), "db.FileInfoTruncated")
 }
 }
-func (m *FileVersion) Marshal() (data []byte, err error) {
+func (m *FileVersion) Marshal() (dAtA []byte, err error) {
 	size := m.ProtoSize()
 	size := m.ProtoSize()
-	data = make([]byte, size)
-	n, err := m.MarshalTo(data)
+	dAtA = make([]byte, size)
+	n, err := m.MarshalTo(dAtA)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	return data[:n], nil
+	return dAtA[:n], nil
 }
 }
 
 
-func (m *FileVersion) MarshalTo(data []byte) (int, error) {
+func (m *FileVersion) MarshalTo(dAtA []byte) (int, error) {
 	var i int
 	var i int
 	_ = i
 	_ = i
 	var l int
 	var l int
 	_ = l
 	_ = l
-	data[i] = 0xa
+	dAtA[i] = 0xa
 	i++
 	i++
-	i = encodeVarintStructs(data, i, uint64(m.Version.ProtoSize()))
-	n1, err := m.Version.MarshalTo(data[i:])
+	i = encodeVarintStructs(dAtA, i, uint64(m.Version.ProtoSize()))
+	n1, err := m.Version.MarshalTo(dAtA[i:])
 	if err != nil {
 	if err != nil {
 		return 0, err
 		return 0, err
 	}
 	}
 	i += n1
 	i += n1
 	if len(m.Device) > 0 {
 	if len(m.Device) > 0 {
-		data[i] = 0x12
+		dAtA[i] = 0x12
 		i++
 		i++
-		i = encodeVarintStructs(data, i, uint64(len(m.Device)))
-		i += copy(data[i:], m.Device)
+		i = encodeVarintStructs(dAtA, i, uint64(len(m.Device)))
+		i += copy(dAtA[i:], m.Device)
 	}
 	}
 	return i, nil
 	return i, nil
 }
 }
 
 
-func (m *VersionList) Marshal() (data []byte, err error) {
+func (m *VersionList) Marshal() (dAtA []byte, err error) {
 	size := m.ProtoSize()
 	size := m.ProtoSize()
-	data = make([]byte, size)
-	n, err := m.MarshalTo(data)
+	dAtA = make([]byte, size)
+	n, err := m.MarshalTo(dAtA)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	return data[:n], nil
+	return dAtA[:n], nil
 }
 }
 
 
-func (m *VersionList) MarshalTo(data []byte) (int, error) {
+func (m *VersionList) MarshalTo(dAtA []byte) (int, error) {
 	var i int
 	var i int
 	_ = i
 	_ = i
 	var l int
 	var l int
 	_ = l
 	_ = l
 	if len(m.Versions) > 0 {
 	if len(m.Versions) > 0 {
 		for _, msg := range m.Versions {
 		for _, msg := range m.Versions {
-			data[i] = 0xa
+			dAtA[i] = 0xa
 			i++
 			i++
-			i = encodeVarintStructs(data, i, uint64(msg.ProtoSize()))
-			n, err := msg.MarshalTo(data[i:])
+			i = encodeVarintStructs(dAtA, i, uint64(msg.ProtoSize()))
+			n, err := msg.MarshalTo(dAtA[i:])
 			if err != nil {
 			if err != nil {
 				return 0, err
 				return 0, err
 			}
 			}
@@ -138,136 +142,136 @@ func (m *VersionList) MarshalTo(data []byte) (int, error) {
 	return i, nil
 	return i, nil
 }
 }
 
 
-func (m *FileInfoTruncated) Marshal() (data []byte, err error) {
+func (m *FileInfoTruncated) Marshal() (dAtA []byte, err error) {
 	size := m.ProtoSize()
 	size := m.ProtoSize()
-	data = make([]byte, size)
-	n, err := m.MarshalTo(data)
+	dAtA = make([]byte, size)
+	n, err := m.MarshalTo(dAtA)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	return data[:n], nil
+	return dAtA[:n], nil
 }
 }
 
 
-func (m *FileInfoTruncated) MarshalTo(data []byte) (int, error) {
+func (m *FileInfoTruncated) MarshalTo(dAtA []byte) (int, error) {
 	var i int
 	var i int
 	_ = i
 	_ = i
 	var l int
 	var l int
 	_ = l
 	_ = l
 	if len(m.Name) > 0 {
 	if len(m.Name) > 0 {
-		data[i] = 0xa
+		dAtA[i] = 0xa
 		i++
 		i++
-		i = encodeVarintStructs(data, i, uint64(len(m.Name)))
-		i += copy(data[i:], m.Name)
+		i = encodeVarintStructs(dAtA, i, uint64(len(m.Name)))
+		i += copy(dAtA[i:], m.Name)
 	}
 	}
 	if m.Type != 0 {
 	if m.Type != 0 {
-		data[i] = 0x10
+		dAtA[i] = 0x10
 		i++
 		i++
-		i = encodeVarintStructs(data, i, uint64(m.Type))
+		i = encodeVarintStructs(dAtA, i, uint64(m.Type))
 	}
 	}
 	if m.Size != 0 {
 	if m.Size != 0 {
-		data[i] = 0x18
+		dAtA[i] = 0x18
 		i++
 		i++
-		i = encodeVarintStructs(data, i, uint64(m.Size))
+		i = encodeVarintStructs(dAtA, i, uint64(m.Size))
 	}
 	}
 	if m.Permissions != 0 {
 	if m.Permissions != 0 {
-		data[i] = 0x20
+		dAtA[i] = 0x20
 		i++
 		i++
-		i = encodeVarintStructs(data, i, uint64(m.Permissions))
+		i = encodeVarintStructs(dAtA, i, uint64(m.Permissions))
 	}
 	}
 	if m.ModifiedS != 0 {
 	if m.ModifiedS != 0 {
-		data[i] = 0x28
+		dAtA[i] = 0x28
 		i++
 		i++
-		i = encodeVarintStructs(data, i, uint64(m.ModifiedS))
+		i = encodeVarintStructs(dAtA, i, uint64(m.ModifiedS))
 	}
 	}
 	if m.Deleted {
 	if m.Deleted {
-		data[i] = 0x30
+		dAtA[i] = 0x30
 		i++
 		i++
 		if m.Deleted {
 		if m.Deleted {
-			data[i] = 1
+			dAtA[i] = 1
 		} else {
 		} else {
-			data[i] = 0
+			dAtA[i] = 0
 		}
 		}
 		i++
 		i++
 	}
 	}
 	if m.Invalid {
 	if m.Invalid {
-		data[i] = 0x38
+		dAtA[i] = 0x38
 		i++
 		i++
 		if m.Invalid {
 		if m.Invalid {
-			data[i] = 1
+			dAtA[i] = 1
 		} else {
 		} else {
-			data[i] = 0
+			dAtA[i] = 0
 		}
 		}
 		i++
 		i++
 	}
 	}
 	if m.NoPermissions {
 	if m.NoPermissions {
-		data[i] = 0x40
+		dAtA[i] = 0x40
 		i++
 		i++
 		if m.NoPermissions {
 		if m.NoPermissions {
-			data[i] = 1
+			dAtA[i] = 1
 		} else {
 		} else {
-			data[i] = 0
+			dAtA[i] = 0
 		}
 		}
 		i++
 		i++
 	}
 	}
-	data[i] = 0x4a
+	dAtA[i] = 0x4a
 	i++
 	i++
-	i = encodeVarintStructs(data, i, uint64(m.Version.ProtoSize()))
-	n2, err := m.Version.MarshalTo(data[i:])
+	i = encodeVarintStructs(dAtA, i, uint64(m.Version.ProtoSize()))
+	n2, err := m.Version.MarshalTo(dAtA[i:])
 	if err != nil {
 	if err != nil {
 		return 0, err
 		return 0, err
 	}
 	}
 	i += n2
 	i += n2
 	if m.Sequence != 0 {
 	if m.Sequence != 0 {
-		data[i] = 0x50
+		dAtA[i] = 0x50
 		i++
 		i++
-		i = encodeVarintStructs(data, i, uint64(m.Sequence))
+		i = encodeVarintStructs(dAtA, i, uint64(m.Sequence))
 	}
 	}
 	if m.ModifiedNs != 0 {
 	if m.ModifiedNs != 0 {
-		data[i] = 0x58
+		dAtA[i] = 0x58
 		i++
 		i++
-		i = encodeVarintStructs(data, i, uint64(m.ModifiedNs))
+		i = encodeVarintStructs(dAtA, i, uint64(m.ModifiedNs))
 	}
 	}
 	if m.ModifiedBy != 0 {
 	if m.ModifiedBy != 0 {
-		data[i] = 0x60
+		dAtA[i] = 0x60
 		i++
 		i++
-		i = encodeVarintStructs(data, i, uint64(m.ModifiedBy))
+		i = encodeVarintStructs(dAtA, i, uint64(m.ModifiedBy))
 	}
 	}
 	if len(m.SymlinkTarget) > 0 {
 	if len(m.SymlinkTarget) > 0 {
-		data[i] = 0x8a
+		dAtA[i] = 0x8a
 		i++
 		i++
-		data[i] = 0x1
+		dAtA[i] = 0x1
 		i++
 		i++
-		i = encodeVarintStructs(data, i, uint64(len(m.SymlinkTarget)))
-		i += copy(data[i:], m.SymlinkTarget)
+		i = encodeVarintStructs(dAtA, i, uint64(len(m.SymlinkTarget)))
+		i += copy(dAtA[i:], m.SymlinkTarget)
 	}
 	}
 	return i, nil
 	return i, nil
 }
 }
 
 
-func encodeFixed64Structs(data []byte, offset int, v uint64) int {
-	data[offset] = uint8(v)
-	data[offset+1] = uint8(v >> 8)
-	data[offset+2] = uint8(v >> 16)
-	data[offset+3] = uint8(v >> 24)
-	data[offset+4] = uint8(v >> 32)
-	data[offset+5] = uint8(v >> 40)
-	data[offset+6] = uint8(v >> 48)
-	data[offset+7] = uint8(v >> 56)
+func encodeFixed64Structs(dAtA []byte, offset int, v uint64) int {
+	dAtA[offset] = uint8(v)
+	dAtA[offset+1] = uint8(v >> 8)
+	dAtA[offset+2] = uint8(v >> 16)
+	dAtA[offset+3] = uint8(v >> 24)
+	dAtA[offset+4] = uint8(v >> 32)
+	dAtA[offset+5] = uint8(v >> 40)
+	dAtA[offset+6] = uint8(v >> 48)
+	dAtA[offset+7] = uint8(v >> 56)
 	return offset + 8
 	return offset + 8
 }
 }
-func encodeFixed32Structs(data []byte, offset int, v uint32) int {
-	data[offset] = uint8(v)
-	data[offset+1] = uint8(v >> 8)
-	data[offset+2] = uint8(v >> 16)
-	data[offset+3] = uint8(v >> 24)
+func encodeFixed32Structs(dAtA []byte, offset int, v uint32) int {
+	dAtA[offset] = uint8(v)
+	dAtA[offset+1] = uint8(v >> 8)
+	dAtA[offset+2] = uint8(v >> 16)
+	dAtA[offset+3] = uint8(v >> 24)
 	return offset + 4
 	return offset + 4
 }
 }
-func encodeVarintStructs(data []byte, offset int, v uint64) int {
+func encodeVarintStructs(dAtA []byte, offset int, v uint64) int {
 	for v >= 1<<7 {
 	for v >= 1<<7 {
-		data[offset] = uint8(v&0x7f | 0x80)
+		dAtA[offset] = uint8(v&0x7f | 0x80)
 		v >>= 7
 		v >>= 7
 		offset++
 		offset++
 	}
 	}
-	data[offset] = uint8(v)
+	dAtA[offset] = uint8(v)
 	return offset + 1
 	return offset + 1
 }
 }
 func (m *FileVersion) ProtoSize() (n int) {
 func (m *FileVersion) ProtoSize() (n int) {
@@ -353,8 +357,8 @@ func sovStructs(x uint64) (n int) {
 func sozStructs(x uint64) (n int) {
 func sozStructs(x uint64) (n int) {
 	return sovStructs(uint64((x << 1) ^ uint64((int64(x) >> 63))))
 	return sovStructs(uint64((x << 1) ^ uint64((int64(x) >> 63))))
 }
 }
-func (m *FileVersion) Unmarshal(data []byte) error {
-	l := len(data)
+func (m *FileVersion) Unmarshal(dAtA []byte) error {
+	l := len(dAtA)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
 		preIndex := iNdEx
 		preIndex := iNdEx
@@ -366,7 +370,7 @@ func (m *FileVersion) Unmarshal(data []byte) error {
 			if iNdEx >= l {
 			if iNdEx >= l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			b := data[iNdEx]
+			b := dAtA[iNdEx]
 			iNdEx++
 			iNdEx++
 			wire |= (uint64(b) & 0x7F) << shift
 			wire |= (uint64(b) & 0x7F) << shift
 			if b < 0x80 {
 			if b < 0x80 {
@@ -394,7 +398,7 @@ func (m *FileVersion) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				msglen |= (int(b) & 0x7F) << shift
 				msglen |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -408,7 +412,7 @@ func (m *FileVersion) Unmarshal(data []byte) error {
 			if postIndex > l {
 			if postIndex > l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			if err := m.Version.Unmarshal(data[iNdEx:postIndex]); err != nil {
+			if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
 				return err
 				return err
 			}
 			}
 			iNdEx = postIndex
 			iNdEx = postIndex
@@ -424,7 +428,7 @@ func (m *FileVersion) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				byteLen |= (int(b) & 0x7F) << shift
 				byteLen |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -438,14 +442,14 @@ func (m *FileVersion) Unmarshal(data []byte) error {
 			if postIndex > l {
 			if postIndex > l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			m.Device = append(m.Device[:0], data[iNdEx:postIndex]...)
+			m.Device = append(m.Device[:0], dAtA[iNdEx:postIndex]...)
 			if m.Device == nil {
 			if m.Device == nil {
 				m.Device = []byte{}
 				m.Device = []byte{}
 			}
 			}
 			iNdEx = postIndex
 			iNdEx = postIndex
 		default:
 		default:
 			iNdEx = preIndex
 			iNdEx = preIndex
-			skippy, err := skipStructs(data[iNdEx:])
+			skippy, err := skipStructs(dAtA[iNdEx:])
 			if err != nil {
 			if err != nil {
 				return err
 				return err
 			}
 			}
@@ -464,8 +468,8 @@ func (m *FileVersion) Unmarshal(data []byte) error {
 	}
 	}
 	return nil
 	return nil
 }
 }
-func (m *VersionList) Unmarshal(data []byte) error {
-	l := len(data)
+func (m *VersionList) Unmarshal(dAtA []byte) error {
+	l := len(dAtA)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
 		preIndex := iNdEx
 		preIndex := iNdEx
@@ -477,7 +481,7 @@ func (m *VersionList) Unmarshal(data []byte) error {
 			if iNdEx >= l {
 			if iNdEx >= l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			b := data[iNdEx]
+			b := dAtA[iNdEx]
 			iNdEx++
 			iNdEx++
 			wire |= (uint64(b) & 0x7F) << shift
 			wire |= (uint64(b) & 0x7F) << shift
 			if b < 0x80 {
 			if b < 0x80 {
@@ -505,7 +509,7 @@ func (m *VersionList) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				msglen |= (int(b) & 0x7F) << shift
 				msglen |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -520,13 +524,13 @@ func (m *VersionList) Unmarshal(data []byte) error {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
 			m.Versions = append(m.Versions, FileVersion{})
 			m.Versions = append(m.Versions, FileVersion{})
-			if err := m.Versions[len(m.Versions)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
+			if err := m.Versions[len(m.Versions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
 				return err
 				return err
 			}
 			}
 			iNdEx = postIndex
 			iNdEx = postIndex
 		default:
 		default:
 			iNdEx = preIndex
 			iNdEx = preIndex
-			skippy, err := skipStructs(data[iNdEx:])
+			skippy, err := skipStructs(dAtA[iNdEx:])
 			if err != nil {
 			if err != nil {
 				return err
 				return err
 			}
 			}
@@ -545,8 +549,8 @@ func (m *VersionList) Unmarshal(data []byte) error {
 	}
 	}
 	return nil
 	return nil
 }
 }
-func (m *FileInfoTruncated) Unmarshal(data []byte) error {
-	l := len(data)
+func (m *FileInfoTruncated) Unmarshal(dAtA []byte) error {
+	l := len(dAtA)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
 		preIndex := iNdEx
 		preIndex := iNdEx
@@ -558,7 +562,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 			if iNdEx >= l {
 			if iNdEx >= l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			b := data[iNdEx]
+			b := dAtA[iNdEx]
 			iNdEx++
 			iNdEx++
 			wire |= (uint64(b) & 0x7F) << shift
 			wire |= (uint64(b) & 0x7F) << shift
 			if b < 0x80 {
 			if b < 0x80 {
@@ -586,7 +590,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				stringLen |= (uint64(b) & 0x7F) << shift
 				stringLen |= (uint64(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -601,7 +605,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 			if postIndex > l {
 			if postIndex > l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			m.Name = string(data[iNdEx:postIndex])
+			m.Name = string(dAtA[iNdEx:postIndex])
 			iNdEx = postIndex
 			iNdEx = postIndex
 		case 2:
 		case 2:
 			if wireType != 0 {
 			if wireType != 0 {
@@ -615,7 +619,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				m.Type |= (protocol.FileInfoType(b) & 0x7F) << shift
 				m.Type |= (protocol.FileInfoType(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -634,7 +638,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				m.Size |= (int64(b) & 0x7F) << shift
 				m.Size |= (int64(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -653,7 +657,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				m.Permissions |= (uint32(b) & 0x7F) << shift
 				m.Permissions |= (uint32(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -672,7 +676,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				m.ModifiedS |= (int64(b) & 0x7F) << shift
 				m.ModifiedS |= (int64(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -691,7 +695,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				v |= (int(b) & 0x7F) << shift
 				v |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -711,7 +715,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				v |= (int(b) & 0x7F) << shift
 				v |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -731,7 +735,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				v |= (int(b) & 0x7F) << shift
 				v |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -751,7 +755,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				msglen |= (int(b) & 0x7F) << shift
 				msglen |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -765,7 +769,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 			if postIndex > l {
 			if postIndex > l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			if err := m.Version.Unmarshal(data[iNdEx:postIndex]); err != nil {
+			if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
 				return err
 				return err
 			}
 			}
 			iNdEx = postIndex
 			iNdEx = postIndex
@@ -781,7 +785,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				m.Sequence |= (int64(b) & 0x7F) << shift
 				m.Sequence |= (int64(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -800,7 +804,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				m.ModifiedNs |= (int32(b) & 0x7F) << shift
 				m.ModifiedNs |= (int32(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -819,9 +823,9 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
-				m.ModifiedBy |= (protocol.ShortID(b) & 0x7F) << shift
+				m.ModifiedBy |= (github_com_syncthing_syncthing_lib_protocol.ShortID(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
 					break
 					break
 				}
 				}
@@ -838,7 +842,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				stringLen |= (uint64(b) & 0x7F) << shift
 				stringLen |= (uint64(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -853,11 +857,11 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 			if postIndex > l {
 			if postIndex > l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			m.SymlinkTarget = string(data[iNdEx:postIndex])
+			m.SymlinkTarget = string(dAtA[iNdEx:postIndex])
 			iNdEx = postIndex
 			iNdEx = postIndex
 		default:
 		default:
 			iNdEx = preIndex
 			iNdEx = preIndex
-			skippy, err := skipStructs(data[iNdEx:])
+			skippy, err := skipStructs(dAtA[iNdEx:])
 			if err != nil {
 			if err != nil {
 				return err
 				return err
 			}
 			}
@@ -876,8 +880,8 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error {
 	}
 	}
 	return nil
 	return nil
 }
 }
-func skipStructs(data []byte) (n int, err error) {
-	l := len(data)
+func skipStructs(dAtA []byte) (n int, err error) {
+	l := len(dAtA)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
 		var wire uint64
 		var wire uint64
@@ -888,7 +892,7 @@ func skipStructs(data []byte) (n int, err error) {
 			if iNdEx >= l {
 			if iNdEx >= l {
 				return 0, io.ErrUnexpectedEOF
 				return 0, io.ErrUnexpectedEOF
 			}
 			}
-			b := data[iNdEx]
+			b := dAtA[iNdEx]
 			iNdEx++
 			iNdEx++
 			wire |= (uint64(b) & 0x7F) << shift
 			wire |= (uint64(b) & 0x7F) << shift
 			if b < 0x80 {
 			if b < 0x80 {
@@ -906,7 +910,7 @@ func skipStructs(data []byte) (n int, err error) {
 					return 0, io.ErrUnexpectedEOF
 					return 0, io.ErrUnexpectedEOF
 				}
 				}
 				iNdEx++
 				iNdEx++
-				if data[iNdEx-1] < 0x80 {
+				if dAtA[iNdEx-1] < 0x80 {
 					break
 					break
 				}
 				}
 			}
 			}
@@ -923,7 +927,7 @@ func skipStructs(data []byte) (n int, err error) {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return 0, io.ErrUnexpectedEOF
 					return 0, io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				length |= (int(b) & 0x7F) << shift
 				length |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -946,7 +950,7 @@ func skipStructs(data []byte) (n int, err error) {
 					if iNdEx >= l {
 					if iNdEx >= l {
 						return 0, io.ErrUnexpectedEOF
 						return 0, io.ErrUnexpectedEOF
 					}
 					}
-					b := data[iNdEx]
+					b := dAtA[iNdEx]
 					iNdEx++
 					iNdEx++
 					innerWire |= (uint64(b) & 0x7F) << shift
 					innerWire |= (uint64(b) & 0x7F) << shift
 					if b < 0x80 {
 					if b < 0x80 {
@@ -957,7 +961,7 @@ func skipStructs(data []byte) (n int, err error) {
 				if innerWireType == 4 {
 				if innerWireType == 4 {
 					break
 					break
 				}
 				}
-				next, err := skipStructs(data[start:])
+				next, err := skipStructs(dAtA[start:])
 				if err != nil {
 				if err != nil {
 					return 0, err
 					return 0, err
 				}
 				}
@@ -981,34 +985,39 @@ var (
 	ErrIntOverflowStructs   = fmt.Errorf("proto: integer overflow")
 	ErrIntOverflowStructs   = fmt.Errorf("proto: integer overflow")
 )
 )
 
 
+func init() { proto.RegisterFile("structs.proto", fileDescriptorStructs) }
+
 var fileDescriptorStructs = []byte{
 var fileDescriptorStructs = []byte{
-	// 442 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x51, 0x5d, 0x8b, 0xd3, 0x40,
-	0x14, 0x6d, 0xb7, 0xd9, 0x7e, 0xdc, 0xd8, 0xd5, 0x1d, 0x64, 0x19, 0x0a, 0xb6, 0x4b, 0x41, 0x10,
-	0xc1, 0x54, 0x57, 0x7c, 0xf1, 0x71, 0x1f, 0x16, 0x04, 0x11, 0x19, 0x97, 0xf5, 0xb1, 0x34, 0x99,
-	0xdb, 0xec, 0x60, 0x32, 0x53, 0x33, 0x93, 0x42, 0xfd, 0x25, 0xbe, 0xb9, 0x3f, 0xa7, 0x8f, 0xfe,
-	0x02, 0xd1, 0xfa, 0x47, 0x9c, 0xce, 0xa4, 0x31, 0x8f, 0xfb, 0x10, 0xb8, 0xe7, 0x9e, 0x73, 0xee,
-	0x3d, 0x93, 0x0b, 0x43, 0x6d, 0x8a, 0x32, 0x31, 0x3a, 0x5a, 0x15, 0xca, 0x28, 0x72, 0xc4, 0xe3,
-	0xd1, 0x8b, 0x54, 0x98, 0xdb, 0x32, 0x8e, 0x12, 0x95, 0xcf, 0x52, 0x95, 0xaa, 0x99, 0xa3, 0xe2,
-	0x72, 0xe9, 0x90, 0x03, 0xae, 0xf2, 0x96, 0xd1, 0x9b, 0x86, 0x5c, 0x6f, 0x64, 0x62, 0x6e, 0x85,
-	0x4c, 0x1b, 0x55, 0x26, 0x62, 0x3f, 0x21, 0x51, 0xd9, 0x2c, 0xc6, 0x95, 0xb7, 0x4d, 0x3f, 0x43,
-	0x78, 0x25, 0x32, 0xbc, 0xc1, 0x42, 0x0b, 0x25, 0xc9, 0x4b, 0xe8, 0xad, 0x7d, 0x49, 0xdb, 0xe7,
-	0xed, 0x67, 0xe1, 0xc5, 0xa3, 0xe8, 0x60, 0x8a, 0x6e, 0x30, 0x31, 0xaa, 0xb8, 0x0c, 0xb6, 0xbf,
-	0x26, 0x2d, 0x76, 0x90, 0x91, 0x33, 0xe8, 0x72, 0x5c, 0x8b, 0x04, 0xe9, 0x91, 0x35, 0x3c, 0x60,
-	0x15, 0x9a, 0x5e, 0x41, 0x58, 0x0d, 0x7d, 0x2f, 0xb4, 0x21, 0xaf, 0xa0, 0x5f, 0x39, 0xb4, 0x9d,
-	0xdc, 0xb1, 0x93, 0x1f, 0x46, 0x3c, 0x8e, 0x1a, 0xbb, 0xab, 0xc1, 0xb5, 0xec, 0x6d, 0xf0, 0xfd,
-	0x6e, 0xd2, 0x9a, 0xfe, 0xe8, 0xc0, 0xe9, 0x5e, 0xf5, 0x4e, 0x2e, 0xd5, 0x75, 0x51, 0xca, 0x64,
-	0x61, 0x90, 0x13, 0x02, 0x81, 0x5c, 0xe4, 0xe8, 0x42, 0x0e, 0x98, 0xab, 0xc9, 0x73, 0x08, 0xcc,
-	0x66, 0xe5, 0x73, 0x9c, 0x5c, 0x9c, 0xfd, 0x0f, 0x5e, 0xdb, 0x2d, 0xcb, 0x9c, 0x66, 0xef, 0xd7,
-	0xe2, 0x1b, 0xd2, 0x8e, 0xd5, 0x76, 0x98, 0xab, 0xc9, 0x39, 0x84, 0x2b, 0x2c, 0x72, 0xa1, 0x7d,
-	0xca, 0xc0, 0x52, 0x43, 0xd6, 0x6c, 0x91, 0x27, 0x00, 0xb9, 0xe2, 0x62, 0x29, 0x90, 0xcf, 0x35,
-	0x3d, 0x76, 0xde, 0xc1, 0xa1, 0xf3, 0x89, 0x50, 0xe8, 0x71, 0xcc, 0xd0, 0xe6, 0xa3, 0x5d, 0xcb,
-	0xf5, 0xd9, 0x01, 0xee, 0x19, 0x21, 0xd7, 0x8b, 0x4c, 0x70, 0xda, 0xf3, 0x4c, 0x05, 0xc9, 0x53,
-	0x38, 0x91, 0x6a, 0xde, 0xdc, 0xdb, 0x77, 0x82, 0xa1, 0x54, 0x1f, 0x1b, 0x9b, 0x1b, 0x77, 0x19,
-	0xdc, 0xef, 0x2e, 0x23, 0xe8, 0x6b, 0xfc, 0x5a, 0xa2, 0xb4, 0x97, 0x01, 0x97, 0xb4, 0xc6, 0x64,
-	0x02, 0x61, 0xfd, 0x0e, 0xbb, 0x31, 0xb4, 0xf4, 0x31, 0xab, 0x9f, 0xf6, 0x41, 0xef, 0x53, 0xe9,
-	0x4d, 0x9e, 0x09, 0xf9, 0x65, 0x6e, 0x16, 0x45, 0x8a, 0x86, 0x9e, 0xba, 0x1f, 0x3d, 0xac, 0xba,
-	0xd7, 0xae, 0xe9, 0x2f, 0x74, 0xf9, 0x78, 0xfb, 0x67, 0xdc, 0xda, 0xee, 0xc6, 0xed, 0x9f, 0xf6,
-	0xfb, 0xbd, 0x1b, 0xb7, 0xee, 0xfe, 0x8e, 0xdb, 0x71, 0xd7, 0xe5, 0x7b, 0xfd, 0x2f, 0x00, 0x00,
-	0xff, 0xff, 0xb1, 0x2f, 0x12, 0xb6, 0xda, 0x02, 0x00, 0x00,
+	// 483 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x4f, 0x6b, 0xdb, 0x4e,
+	0x10, 0xf5, 0xc6, 0x8a, 0xff, 0xac, 0xe2, 0xfc, 0x7e, 0x59, 0x4a, 0x58, 0x0c, 0x95, 0x85, 0xa1,
+	0x20, 0x0a, 0x95, 0x5b, 0x87, 0x5e, 0xda, 0x9b, 0x29, 0x81, 0x40, 0x29, 0x45, 0x09, 0xe9, 0xa5,
+	0x60, 0x2c, 0x69, 0x2c, 0x2f, 0x95, 0x76, 0x55, 0xed, 0xca, 0xa0, 0x7e, 0x92, 0x1e, 0xf3, 0x71,
+	0x7c, 0xec, 0xb9, 0x87, 0xd0, 0xba, 0x9f, 0xa3, 0x50, 0xb4, 0x92, 0x15, 0x1d, 0xdb, 0xdb, 0xbc,
+	0xd9, 0xf7, 0xe6, 0xbd, 0x61, 0x16, 0x8f, 0xa4, 0xca, 0xf2, 0x40, 0x49, 0x37, 0xcd, 0x84, 0x12,
+	0xe4, 0x28, 0xf4, 0xc7, 0xcf, 0x22, 0xa6, 0x36, 0xb9, 0xef, 0x06, 0x22, 0x99, 0x45, 0x22, 0x12,
+	0x33, 0xfd, 0xe4, 0xe7, 0x6b, 0x8d, 0x34, 0xd0, 0x55, 0x25, 0x19, 0xbf, 0x6c, 0xd1, 0x65, 0xc1,
+	0x03, 0xb5, 0x61, 0x3c, 0x6a, 0x55, 0x31, 0xf3, 0xab, 0x09, 0x81, 0x88, 0x67, 0x3e, 0xa4, 0x95,
+	0x6c, 0xfa, 0x01, 0x9b, 0x97, 0x2c, 0x86, 0x5b, 0xc8, 0x24, 0x13, 0x9c, 0x3c, 0xc7, 0xfd, 0x6d,
+	0x55, 0x52, 0x64, 0x23, 0xc7, 0x9c, 0xff, 0xef, 0x1e, 0x44, 0xee, 0x2d, 0x04, 0x4a, 0x64, 0x0b,
+	0x63, 0x77, 0x3f, 0xe9, 0x78, 0x07, 0x1a, 0x39, 0xc7, 0xbd, 0x10, 0xb6, 0x2c, 0x00, 0x7a, 0x64,
+	0x23, 0xe7, 0xc4, 0xab, 0xd1, 0xf4, 0x12, 0x9b, 0xf5, 0xd0, 0xb7, 0x4c, 0x2a, 0xf2, 0x02, 0x0f,
+	0x6a, 0x85, 0xa4, 0xc8, 0xee, 0x3a, 0xe6, 0xfc, 0x3f, 0x37, 0xf4, 0xdd, 0x96, 0x77, 0x3d, 0xb8,
+	0xa1, 0xbd, 0x32, 0xbe, 0xde, 0x4d, 0x3a, 0xd3, 0xdf, 0x5d, 0x7c, 0x56, 0xb2, 0xae, 0xf8, 0x5a,
+	0xdc, 0x64, 0x39, 0x0f, 0x56, 0x0a, 0x42, 0x42, 0xb0, 0xc1, 0x57, 0x09, 0xe8, 0x90, 0x43, 0x4f,
+	0xd7, 0xe4, 0x29, 0x36, 0x54, 0x91, 0x56, 0x39, 0x4e, 0xe7, 0xe7, 0x0f, 0xc1, 0x1b, 0x79, 0x91,
+	0x82, 0xa7, 0x39, 0xa5, 0x5e, 0xb2, 0x2f, 0x40, 0xbb, 0x36, 0x72, 0xba, 0x9e, 0xae, 0x89, 0x8d,
+	0xcd, 0x14, 0xb2, 0x84, 0xc9, 0x2a, 0xa5, 0x61, 0x23, 0x67, 0xe4, 0xb5, 0x5b, 0xe4, 0x31, 0xc6,
+	0x89, 0x08, 0xd9, 0x9a, 0x41, 0xb8, 0x94, 0xf4, 0x58, 0x6b, 0x87, 0x87, 0xce, 0x35, 0xa1, 0xb8,
+	0x1f, 0x42, 0x0c, 0x0a, 0x42, 0xda, 0xb3, 0x91, 0x33, 0xf0, 0x0e, 0xb0, 0x7c, 0x61, 0x7c, 0xbb,
+	0x8a, 0x59, 0x48, 0xfb, 0xd5, 0x4b, 0x0d, 0xc9, 0x13, 0x7c, 0xca, 0xc5, 0xb2, 0xed, 0x3b, 0xd0,
+	0x84, 0x11, 0x17, 0xef, 0x5b, 0xce, 0xad, 0xbb, 0x0c, 0xff, 0xee, 0x2e, 0x63, 0x3c, 0x90, 0xf0,
+	0x39, 0x07, 0x1e, 0x00, 0xc5, 0x3a, 0x69, 0x83, 0xc9, 0x04, 0x9b, 0xcd, 0x1e, 0x5c, 0x52, 0xd3,
+	0x46, 0xce, 0xb1, 0xd7, 0xac, 0xf6, 0x4e, 0x92, 0x8f, 0x2d, 0x82, 0x5f, 0xd0, 0x13, 0x1b, 0x39,
+	0xc6, 0xe2, 0x75, 0x69, 0xf0, 0xfd, 0x7e, 0x72, 0xf1, 0x0f, 0x3f, 0xcd, 0xbd, 0xde, 0x88, 0x4c,
+	0x5d, 0xbd, 0x79, 0x98, 0xbe, 0x28, 0xca, 0x9d, 0x65, 0x91, 0xc4, 0x8c, 0x7f, 0x5a, 0xaa, 0x55,
+	0x16, 0x81, 0xa2, 0x67, 0xfa, 0x8c, 0xa3, 0xba, 0x7b, 0xa3, 0x9b, 0xd5, 0xfd, 0x17, 0x8f, 0x76,
+	0x3f, 0xad, 0xce, 0x6e, 0x6f, 0xa1, 0x6f, 0x7b, 0x0b, 0xfd, 0xd8, 0x5b, 0x9d, 0xbb, 0x5f, 0x16,
+	0xf2, 0x7b, 0xda, 0xe0, 0xe2, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9e, 0xcd, 0xe3, 0xfd, 0x38,
+	0x03, 0x00, 0x00,
 }
 }

+ 1 - 1
lib/db/structs.proto

@@ -28,7 +28,7 @@ message FileInfoTruncated {
     uint32                permissions    = 4;
     uint32                permissions    = 4;
     int64                 modified_s     = 5;
     int64                 modified_s     = 5;
     int32                 modified_ns    = 11;
     int32                 modified_ns    = 11;
-    uint64                modified_by    = 12 [(gogoproto.customtype) = "protocol.ShortID", (gogoproto.nullable) = false];
+    uint64                modified_by    = 12 [(gogoproto.customtype) = "github.com/syncthing/syncthing/lib/protocol.ShortID", (gogoproto.nullable) = false];
     bool                  deleted        = 6;
     bool                  deleted        = 6;
     bool                  invalid        = 7;
     bool                  invalid        = 7;
     bool                  no_permissions = 8;
     bool                  no_permissions = 8;

+ 1 - 1
lib/discover/local.go

@@ -5,7 +5,7 @@
 // You can obtain one at http://mozilla.org/MPL/2.0/.
 // You can obtain one at http://mozilla.org/MPL/2.0/.
 
 
 //go:generate go run ../../script/protofmt.go local.proto
 //go:generate go run ../../script/protofmt.go local.proto
-//go:generate protoc -I ../../../../../ -I ../../../../gogo/protobuf/protobuf -I . --gogofast_out=. local.proto
+//go:generate protoc -I ../../vendor/ -I ../../vendor/github.com/gogo/protobuf/protobuf -I . --gogofast_out=. local.proto
 
 
 package discover
 package discover
 
 

+ 69 - 64
lib/discover/local.pb.go

@@ -29,7 +29,9 @@ var _ = math.Inf
 
 
 // This is a compile-time assertion to ensure that this generated file
 // This is a compile-time assertion to ensure that this generated file
 // is compatible with the proto package it is being compiled against.
 // is compatible with the proto package it is being compiled against.
-const _ = proto.GoGoProtoPackageIsVersion1
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
 
 
 type Announce struct {
 type Announce struct {
 	ID         github_com_syncthing_syncthing_lib_protocol.DeviceID `protobuf:"bytes,1,opt,name=id,proto3,customtype=github.com/syncthing/syncthing/lib/protocol.DeviceID" json:"id"`
 	ID         github_com_syncthing_syncthing_lib_protocol.DeviceID `protobuf:"bytes,1,opt,name=id,proto3,customtype=github.com/syncthing/syncthing/lib/protocol.DeviceID" json:"id"`
@@ -45,77 +47,77 @@ func (*Announce) Descriptor() ([]byte, []int) { return fileDescriptorLocal, []in
 func init() {
 func init() {
 	proto.RegisterType((*Announce)(nil), "discover.Announce")
 	proto.RegisterType((*Announce)(nil), "discover.Announce")
 }
 }
-func (m *Announce) Marshal() (data []byte, err error) {
+func (m *Announce) Marshal() (dAtA []byte, err error) {
 	size := m.ProtoSize()
 	size := m.ProtoSize()
-	data = make([]byte, size)
-	n, err := m.MarshalTo(data)
+	dAtA = make([]byte, size)
+	n, err := m.MarshalTo(dAtA)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	return data[:n], nil
+	return dAtA[:n], nil
 }
 }
 
 
-func (m *Announce) MarshalTo(data []byte) (int, error) {
+func (m *Announce) MarshalTo(dAtA []byte) (int, error) {
 	var i int
 	var i int
 	_ = i
 	_ = i
 	var l int
 	var l int
 	_ = l
 	_ = l
-	data[i] = 0xa
+	dAtA[i] = 0xa
 	i++
 	i++
-	i = encodeVarintLocal(data, i, uint64(m.ID.ProtoSize()))
-	n1, err := m.ID.MarshalTo(data[i:])
+	i = encodeVarintLocal(dAtA, i, uint64(m.ID.ProtoSize()))
+	n1, err := m.ID.MarshalTo(dAtA[i:])
 	if err != nil {
 	if err != nil {
 		return 0, err
 		return 0, err
 	}
 	}
 	i += n1
 	i += n1
 	if len(m.Addresses) > 0 {
 	if len(m.Addresses) > 0 {
 		for _, s := range m.Addresses {
 		for _, s := range m.Addresses {
-			data[i] = 0x12
+			dAtA[i] = 0x12
 			i++
 			i++
 			l = len(s)
 			l = len(s)
 			for l >= 1<<7 {
 			for l >= 1<<7 {
-				data[i] = uint8(uint64(l)&0x7f | 0x80)
+				dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
 				l >>= 7
 				l >>= 7
 				i++
 				i++
 			}
 			}
-			data[i] = uint8(l)
+			dAtA[i] = uint8(l)
 			i++
 			i++
-			i += copy(data[i:], s)
+			i += copy(dAtA[i:], s)
 		}
 		}
 	}
 	}
 	if m.InstanceID != 0 {
 	if m.InstanceID != 0 {
-		data[i] = 0x18
+		dAtA[i] = 0x18
 		i++
 		i++
-		i = encodeVarintLocal(data, i, uint64(m.InstanceID))
+		i = encodeVarintLocal(dAtA, i, uint64(m.InstanceID))
 	}
 	}
 	return i, nil
 	return i, nil
 }
 }
 
 
-func encodeFixed64Local(data []byte, offset int, v uint64) int {
-	data[offset] = uint8(v)
-	data[offset+1] = uint8(v >> 8)
-	data[offset+2] = uint8(v >> 16)
-	data[offset+3] = uint8(v >> 24)
-	data[offset+4] = uint8(v >> 32)
-	data[offset+5] = uint8(v >> 40)
-	data[offset+6] = uint8(v >> 48)
-	data[offset+7] = uint8(v >> 56)
+func encodeFixed64Local(dAtA []byte, offset int, v uint64) int {
+	dAtA[offset] = uint8(v)
+	dAtA[offset+1] = uint8(v >> 8)
+	dAtA[offset+2] = uint8(v >> 16)
+	dAtA[offset+3] = uint8(v >> 24)
+	dAtA[offset+4] = uint8(v >> 32)
+	dAtA[offset+5] = uint8(v >> 40)
+	dAtA[offset+6] = uint8(v >> 48)
+	dAtA[offset+7] = uint8(v >> 56)
 	return offset + 8
 	return offset + 8
 }
 }
-func encodeFixed32Local(data []byte, offset int, v uint32) int {
-	data[offset] = uint8(v)
-	data[offset+1] = uint8(v >> 8)
-	data[offset+2] = uint8(v >> 16)
-	data[offset+3] = uint8(v >> 24)
+func encodeFixed32Local(dAtA []byte, offset int, v uint32) int {
+	dAtA[offset] = uint8(v)
+	dAtA[offset+1] = uint8(v >> 8)
+	dAtA[offset+2] = uint8(v >> 16)
+	dAtA[offset+3] = uint8(v >> 24)
 	return offset + 4
 	return offset + 4
 }
 }
-func encodeVarintLocal(data []byte, offset int, v uint64) int {
+func encodeVarintLocal(dAtA []byte, offset int, v uint64) int {
 	for v >= 1<<7 {
 	for v >= 1<<7 {
-		data[offset] = uint8(v&0x7f | 0x80)
+		dAtA[offset] = uint8(v&0x7f | 0x80)
 		v >>= 7
 		v >>= 7
 		offset++
 		offset++
 	}
 	}
-	data[offset] = uint8(v)
+	dAtA[offset] = uint8(v)
 	return offset + 1
 	return offset + 1
 }
 }
 func (m *Announce) ProtoSize() (n int) {
 func (m *Announce) ProtoSize() (n int) {
@@ -148,8 +150,8 @@ func sovLocal(x uint64) (n int) {
 func sozLocal(x uint64) (n int) {
 func sozLocal(x uint64) (n int) {
 	return sovLocal(uint64((x << 1) ^ uint64((int64(x) >> 63))))
 	return sovLocal(uint64((x << 1) ^ uint64((int64(x) >> 63))))
 }
 }
-func (m *Announce) Unmarshal(data []byte) error {
-	l := len(data)
+func (m *Announce) Unmarshal(dAtA []byte) error {
+	l := len(dAtA)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
 		preIndex := iNdEx
 		preIndex := iNdEx
@@ -161,7 +163,7 @@ func (m *Announce) Unmarshal(data []byte) error {
 			if iNdEx >= l {
 			if iNdEx >= l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			b := data[iNdEx]
+			b := dAtA[iNdEx]
 			iNdEx++
 			iNdEx++
 			wire |= (uint64(b) & 0x7F) << shift
 			wire |= (uint64(b) & 0x7F) << shift
 			if b < 0x80 {
 			if b < 0x80 {
@@ -189,7 +191,7 @@ func (m *Announce) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				byteLen |= (int(b) & 0x7F) << shift
 				byteLen |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -203,7 +205,7 @@ func (m *Announce) Unmarshal(data []byte) error {
 			if postIndex > l {
 			if postIndex > l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			if err := m.ID.Unmarshal(data[iNdEx:postIndex]); err != nil {
+			if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
 				return err
 				return err
 			}
 			}
 			iNdEx = postIndex
 			iNdEx = postIndex
@@ -219,7 +221,7 @@ func (m *Announce) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				stringLen |= (uint64(b) & 0x7F) << shift
 				stringLen |= (uint64(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -234,7 +236,7 @@ func (m *Announce) Unmarshal(data []byte) error {
 			if postIndex > l {
 			if postIndex > l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			m.Addresses = append(m.Addresses, string(data[iNdEx:postIndex]))
+			m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex]))
 			iNdEx = postIndex
 			iNdEx = postIndex
 		case 3:
 		case 3:
 			if wireType != 0 {
 			if wireType != 0 {
@@ -248,7 +250,7 @@ func (m *Announce) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				m.InstanceID |= (int64(b) & 0x7F) << shift
 				m.InstanceID |= (int64(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -257,7 +259,7 @@ func (m *Announce) Unmarshal(data []byte) error {
 			}
 			}
 		default:
 		default:
 			iNdEx = preIndex
 			iNdEx = preIndex
-			skippy, err := skipLocal(data[iNdEx:])
+			skippy, err := skipLocal(dAtA[iNdEx:])
 			if err != nil {
 			if err != nil {
 				return err
 				return err
 			}
 			}
@@ -276,8 +278,8 @@ func (m *Announce) Unmarshal(data []byte) error {
 	}
 	}
 	return nil
 	return nil
 }
 }
-func skipLocal(data []byte) (n int, err error) {
-	l := len(data)
+func skipLocal(dAtA []byte) (n int, err error) {
+	l := len(dAtA)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
 		var wire uint64
 		var wire uint64
@@ -288,7 +290,7 @@ func skipLocal(data []byte) (n int, err error) {
 			if iNdEx >= l {
 			if iNdEx >= l {
 				return 0, io.ErrUnexpectedEOF
 				return 0, io.ErrUnexpectedEOF
 			}
 			}
-			b := data[iNdEx]
+			b := dAtA[iNdEx]
 			iNdEx++
 			iNdEx++
 			wire |= (uint64(b) & 0x7F) << shift
 			wire |= (uint64(b) & 0x7F) << shift
 			if b < 0x80 {
 			if b < 0x80 {
@@ -306,7 +308,7 @@ func skipLocal(data []byte) (n int, err error) {
 					return 0, io.ErrUnexpectedEOF
 					return 0, io.ErrUnexpectedEOF
 				}
 				}
 				iNdEx++
 				iNdEx++
-				if data[iNdEx-1] < 0x80 {
+				if dAtA[iNdEx-1] < 0x80 {
 					break
 					break
 				}
 				}
 			}
 			}
@@ -323,7 +325,7 @@ func skipLocal(data []byte) (n int, err error) {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return 0, io.ErrUnexpectedEOF
 					return 0, io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				length |= (int(b) & 0x7F) << shift
 				length |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -346,7 +348,7 @@ func skipLocal(data []byte) (n int, err error) {
 					if iNdEx >= l {
 					if iNdEx >= l {
 						return 0, io.ErrUnexpectedEOF
 						return 0, io.ErrUnexpectedEOF
 					}
 					}
-					b := data[iNdEx]
+					b := dAtA[iNdEx]
 					iNdEx++
 					iNdEx++
 					innerWire |= (uint64(b) & 0x7F) << shift
 					innerWire |= (uint64(b) & 0x7F) << shift
 					if b < 0x80 {
 					if b < 0x80 {
@@ -357,7 +359,7 @@ func skipLocal(data []byte) (n int, err error) {
 				if innerWireType == 4 {
 				if innerWireType == 4 {
 					break
 					break
 				}
 				}
-				next, err := skipLocal(data[start:])
+				next, err := skipLocal(dAtA[start:])
 				if err != nil {
 				if err != nil {
 					return 0, err
 					return 0, err
 				}
 				}
@@ -381,21 +383,24 @@ var (
 	ErrIntOverflowLocal   = fmt.Errorf("proto: integer overflow")
 	ErrIntOverflowLocal   = fmt.Errorf("proto: integer overflow")
 )
 )
 
 
+func init() { proto.RegisterFile("local.proto", fileDescriptorLocal) }
+
 var fileDescriptorLocal = []byte{
 var fileDescriptorLocal = []byte{
-	// 235 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0xce, 0xc9, 0x4f, 0x4e,
-	0xcc, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x48, 0xc9, 0x2c, 0x4e, 0xce, 0x2f, 0x4b,
-	0x2d, 0x92, 0xd2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf,
-	0x4f, 0xcf, 0xd7, 0x07, 0x2b, 0x48, 0x2a, 0x4d, 0x03, 0xf3, 0xc0, 0x1c, 0x30, 0x0b, 0xa2, 0x51,
-	0x69, 0x2d, 0x23, 0x17, 0x87, 0x63, 0x5e, 0x5e, 0x7e, 0x69, 0x5e, 0x72, 0xaa, 0x50, 0x10, 0x17,
-	0x53, 0x66, 0x8a, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x8f, 0x93, 0xd3, 0x89, 0x7b, 0xf2, 0x0c, 0xb7,
-	0xee, 0xc9, 0x9b, 0x20, 0x99, 0x57, 0x5c, 0x99, 0x97, 0x5c, 0x92, 0x91, 0x99, 0x97, 0x8e, 0xc4,
-	0xca, 0xc9, 0x4c, 0x82, 0x58, 0x91, 0x9c, 0x9f, 0xa3, 0xe7, 0x92, 0x5a, 0x96, 0x99, 0x9c, 0xea,
-	0xe9, 0xf2, 0xe8, 0x9e, 0x3c, 0x93, 0xa7, 0x4b, 0x10, 0xd0, 0x34, 0x21, 0x19, 0x2e, 0xce, 0xc4,
-	0x94, 0x94, 0xa2, 0xd4, 0xe2, 0xe2, 0xd4, 0x62, 0x09, 0x26, 0x05, 0x66, 0x0d, 0xce, 0x20, 0x84,
-	0x80, 0x90, 0x3e, 0x17, 0x77, 0x66, 0x5e, 0x71, 0x49, 0x22, 0xd0, 0xf6, 0x78, 0xa0, 0xd5, 0xcc,
-	0x40, 0xab, 0x99, 0x9d, 0xf8, 0x80, 0xda, 0xb9, 0x3c, 0xa1, 0xc2, 0x40, 0x63, 0xb8, 0x60, 0x4a,
-	0x3c, 0x53, 0x9c, 0x44, 0x4e, 0x3c, 0x94, 0x63, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0x02, 0x10, 0x3f,
-	0x78, 0x24, 0xc7, 0xb0, 0xe0, 0xb1, 0x1c, 0x63, 0x12, 0x1b, 0xd8, 0x05, 0xc6, 0x80, 0x00, 0x00,
-	0x00, 0xff, 0xff, 0xa4, 0x46, 0x4f, 0x13, 0x14, 0x01, 0x00, 0x00,
+	// 241 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x8e, 0x4f, 0x4e, 0x84, 0x30,
+	0x14, 0xc6, 0x29, 0x24, 0x66, 0xa6, 0x63, 0x5c, 0x10, 0x17, 0xc4, 0x98, 0x42, 0x5c, 0xb1, 0x11,
+	0x16, 0x7a, 0x01, 0x09, 0x9b, 0x6e, 0xb9, 0x80, 0x81, 0xb6, 0x32, 0x2f, 0xc1, 0x3e, 0x43, 0x61,
+	0x12, 0x6f, 0xe3, 0x05, 0xbc, 0x07, 0x4b, 0xd7, 0x2e, 0x1a, 0xad, 0x17, 0x31, 0xe9, 0x68, 0x86,
+	0xdd, 0xf7, 0xfd, 0xf2, 0x7b, 0x7f, 0xe8, 0x6e, 0x40, 0xd1, 0x0e, 0xc5, 0xcb, 0x88, 0x13, 0xc6,
+	0x1b, 0x09, 0x46, 0xe0, 0x41, 0x8d, 0x57, 0xb7, 0x3d, 0x4c, 0xfb, 0xb9, 0x2b, 0x04, 0x3e, 0x97,
+	0x3d, 0xf6, 0x58, 0x7a, 0xa1, 0x9b, 0x9f, 0x7c, 0xf3, 0xc5, 0xa7, 0xe3, 0xe0, 0xcd, 0x3b, 0xa1,
+	0x9b, 0x07, 0xad, 0x71, 0xd6, 0x42, 0xc5, 0x0d, 0x0d, 0x41, 0x26, 0x24, 0x23, 0xf9, 0x79, 0x55,
+	0x2d, 0x36, 0x0d, 0x3e, 0x6d, 0x7a, 0xbf, 0xda, 0x67, 0x5e, 0xb5, 0x98, 0xf6, 0xa0, 0xfb, 0x55,
+	0x1a, 0xa0, 0x3b, 0x9e, 0x10, 0x38, 0x14, 0xb5, 0x3a, 0x80, 0x50, 0xbc, 0x76, 0x36, 0x0d, 0x79,
+	0xdd, 0x84, 0x20, 0xe3, 0x6b, 0xba, 0x6d, 0xa5, 0x1c, 0x95, 0x31, 0xca, 0x24, 0x61, 0x16, 0xe5,
+	0xdb, 0xe6, 0x04, 0xe2, 0x92, 0xee, 0x40, 0x9b, 0xa9, 0xd5, 0x42, 0x3d, 0x82, 0x4c, 0xa2, 0x8c,
+	0xe4, 0x51, 0x75, 0xe1, 0x6c, 0x4a, 0xf9, 0x1f, 0xe6, 0x75, 0x43, 0xff, 0x15, 0x2e, 0xab, 0xcb,
+	0xe5, 0x9b, 0x05, 0x8b, 0x63, 0xe4, 0xc3, 0x31, 0xf2, 0xe5, 0x58, 0xf0, 0xf6, 0xc3, 0x48, 0x77,
+	0xe6, 0x3f, 0xb8, 0xfb, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x46, 0x4f, 0x13, 0x14, 0x01, 0x00,
+	0x00,
 }
 }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 256 - 254
lib/protocol/bep.pb.go


+ 1 - 3
lib/protocol/bep.proto

@@ -1,5 +1,3 @@
-// protoc protoc -I ../../../../../ -I ../../../../gogo/protobuf/protobuf -I . --gogofast_out=. message.proto
-
 syntax = "proto3";
 syntax = "proto3";
 
 
 package protocol;
 package protocol;
@@ -175,7 +173,7 @@ message FileDownloadProgressUpdate {
     FileDownloadProgressUpdateType update_type   = 1;
     FileDownloadProgressUpdateType update_type   = 1;
     string                         name          = 2;
     string                         name          = 2;
     Vector                         version       = 3 [(gogoproto.nullable) = false];
     Vector                         version       = 3 [(gogoproto.nullable) = false];
-    repeated int32                 block_indexes = 4;
+    repeated int32                 block_indexes = 4 [packed=false];
 }
 }
 
 
 enum FileDownloadProgressUpdateType {
 enum FileDownloadProgressUpdateType {

+ 1 - 1
lib/protocol/bep_extensions.go

@@ -1,7 +1,7 @@
 // Copyright (C) 2014 The Protocol Authors.
 // Copyright (C) 2014 The Protocol Authors.
 
 
 //go:generate go run ../../script/protofmt.go bep.proto
 //go:generate go run ../../script/protofmt.go bep.proto
-//go:generate protoc -I ../../../../../ -I ../../../../gogo/protobuf/protobuf -I . --gogofast_out=. bep.proto
+//go:generate protoc -I ../../vendor/ -I ../../vendor/github.com/gogo/protobuf/protobuf -I . --gogofast_out=. bep.proto
 
 
 package protocol
 package protocol
 
 

+ 1 - 1
lib/protocol/deviceid_test.go

@@ -1,7 +1,7 @@
 // Copyright (C) 2014 The Protocol Authors.
 // Copyright (C) 2014 The Protocol Authors.
 
 
 //go:generate go run ../../script/protofmt.go deviceid_test.proto
 //go:generate go run ../../script/protofmt.go deviceid_test.proto
-//go:generate protoc -I ../../../../../ -I ../../../../gogo/protobuf/protobuf -I . --gogofast_out=. deviceid_test.proto
+//go:generate protoc -I ../../vendor/ -I ../../vendor/github.com/gogo/protobuf/protobuf -I . --gogofast_out=. deviceid_test.proto
 
 
 package protocol
 package protocol
 
 

+ 66 - 62
lib/protocol/deviceid_test.pb.go

@@ -28,7 +28,9 @@ var _ = math.Inf
 
 
 // This is a compile-time assertion to ensure that this generated file
 // This is a compile-time assertion to ensure that this generated file
 // is compatible with the proto package it is being compiled against.
 // is compatible with the proto package it is being compiled against.
-const _ = proto.GoGoProtoPackageIsVersion1
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
 
 
 type TestOldDeviceID struct {
 type TestOldDeviceID struct {
 	Test []byte `protobuf:"bytes,1,opt,name=test,proto3" json:"test,omitempty"`
 	Test []byte `protobuf:"bytes,1,opt,name=test,proto3" json:"test,omitempty"`
@@ -52,49 +54,49 @@ func init() {
 	proto.RegisterType((*TestOldDeviceID)(nil), "protocol.TestOldDeviceID")
 	proto.RegisterType((*TestOldDeviceID)(nil), "protocol.TestOldDeviceID")
 	proto.RegisterType((*TestNewDeviceID)(nil), "protocol.TestNewDeviceID")
 	proto.RegisterType((*TestNewDeviceID)(nil), "protocol.TestNewDeviceID")
 }
 }
-func (m *TestOldDeviceID) Marshal() (data []byte, err error) {
+func (m *TestOldDeviceID) Marshal() (dAtA []byte, err error) {
 	size := m.ProtoSize()
 	size := m.ProtoSize()
-	data = make([]byte, size)
-	n, err := m.MarshalTo(data)
+	dAtA = make([]byte, size)
+	n, err := m.MarshalTo(dAtA)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	return data[:n], nil
+	return dAtA[:n], nil
 }
 }
 
 
-func (m *TestOldDeviceID) MarshalTo(data []byte) (int, error) {
+func (m *TestOldDeviceID) MarshalTo(dAtA []byte) (int, error) {
 	var i int
 	var i int
 	_ = i
 	_ = i
 	var l int
 	var l int
 	_ = l
 	_ = l
 	if len(m.Test) > 0 {
 	if len(m.Test) > 0 {
-		data[i] = 0xa
+		dAtA[i] = 0xa
 		i++
 		i++
-		i = encodeVarintDeviceidTest(data, i, uint64(len(m.Test)))
-		i += copy(data[i:], m.Test)
+		i = encodeVarintDeviceidTest(dAtA, i, uint64(len(m.Test)))
+		i += copy(dAtA[i:], m.Test)
 	}
 	}
 	return i, nil
 	return i, nil
 }
 }
 
 
-func (m *TestNewDeviceID) Marshal() (data []byte, err error) {
+func (m *TestNewDeviceID) Marshal() (dAtA []byte, err error) {
 	size := m.ProtoSize()
 	size := m.ProtoSize()
-	data = make([]byte, size)
-	n, err := m.MarshalTo(data)
+	dAtA = make([]byte, size)
+	n, err := m.MarshalTo(dAtA)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	return data[:n], nil
+	return dAtA[:n], nil
 }
 }
 
 
-func (m *TestNewDeviceID) MarshalTo(data []byte) (int, error) {
+func (m *TestNewDeviceID) MarshalTo(dAtA []byte) (int, error) {
 	var i int
 	var i int
 	_ = i
 	_ = i
 	var l int
 	var l int
 	_ = l
 	_ = l
-	data[i] = 0xa
+	dAtA[i] = 0xa
 	i++
 	i++
-	i = encodeVarintDeviceidTest(data, i, uint64(m.Test.ProtoSize()))
-	n1, err := m.Test.MarshalTo(data[i:])
+	i = encodeVarintDeviceidTest(dAtA, i, uint64(m.Test.ProtoSize()))
+	n1, err := m.Test.MarshalTo(dAtA[i:])
 	if err != nil {
 	if err != nil {
 		return 0, err
 		return 0, err
 	}
 	}
@@ -102,31 +104,31 @@ func (m *TestNewDeviceID) MarshalTo(data []byte) (int, error) {
 	return i, nil
 	return i, nil
 }
 }
 
 
-func encodeFixed64DeviceidTest(data []byte, offset int, v uint64) int {
-	data[offset] = uint8(v)
-	data[offset+1] = uint8(v >> 8)
-	data[offset+2] = uint8(v >> 16)
-	data[offset+3] = uint8(v >> 24)
-	data[offset+4] = uint8(v >> 32)
-	data[offset+5] = uint8(v >> 40)
-	data[offset+6] = uint8(v >> 48)
-	data[offset+7] = uint8(v >> 56)
+func encodeFixed64DeviceidTest(dAtA []byte, offset int, v uint64) int {
+	dAtA[offset] = uint8(v)
+	dAtA[offset+1] = uint8(v >> 8)
+	dAtA[offset+2] = uint8(v >> 16)
+	dAtA[offset+3] = uint8(v >> 24)
+	dAtA[offset+4] = uint8(v >> 32)
+	dAtA[offset+5] = uint8(v >> 40)
+	dAtA[offset+6] = uint8(v >> 48)
+	dAtA[offset+7] = uint8(v >> 56)
 	return offset + 8
 	return offset + 8
 }
 }
-func encodeFixed32DeviceidTest(data []byte, offset int, v uint32) int {
-	data[offset] = uint8(v)
-	data[offset+1] = uint8(v >> 8)
-	data[offset+2] = uint8(v >> 16)
-	data[offset+3] = uint8(v >> 24)
+func encodeFixed32DeviceidTest(dAtA []byte, offset int, v uint32) int {
+	dAtA[offset] = uint8(v)
+	dAtA[offset+1] = uint8(v >> 8)
+	dAtA[offset+2] = uint8(v >> 16)
+	dAtA[offset+3] = uint8(v >> 24)
 	return offset + 4
 	return offset + 4
 }
 }
-func encodeVarintDeviceidTest(data []byte, offset int, v uint64) int {
+func encodeVarintDeviceidTest(dAtA []byte, offset int, v uint64) int {
 	for v >= 1<<7 {
 	for v >= 1<<7 {
-		data[offset] = uint8(v&0x7f | 0x80)
+		dAtA[offset] = uint8(v&0x7f | 0x80)
 		v >>= 7
 		v >>= 7
 		offset++
 		offset++
 	}
 	}
-	data[offset] = uint8(v)
+	dAtA[offset] = uint8(v)
 	return offset + 1
 	return offset + 1
 }
 }
 func (m *TestOldDeviceID) ProtoSize() (n int) {
 func (m *TestOldDeviceID) ProtoSize() (n int) {
@@ -160,8 +162,8 @@ func sovDeviceidTest(x uint64) (n int) {
 func sozDeviceidTest(x uint64) (n int) {
 func sozDeviceidTest(x uint64) (n int) {
 	return sovDeviceidTest(uint64((x << 1) ^ uint64((int64(x) >> 63))))
 	return sovDeviceidTest(uint64((x << 1) ^ uint64((int64(x) >> 63))))
 }
 }
-func (m *TestOldDeviceID) Unmarshal(data []byte) error {
-	l := len(data)
+func (m *TestOldDeviceID) Unmarshal(dAtA []byte) error {
+	l := len(dAtA)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
 		preIndex := iNdEx
 		preIndex := iNdEx
@@ -173,7 +175,7 @@ func (m *TestOldDeviceID) Unmarshal(data []byte) error {
 			if iNdEx >= l {
 			if iNdEx >= l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			b := data[iNdEx]
+			b := dAtA[iNdEx]
 			iNdEx++
 			iNdEx++
 			wire |= (uint64(b) & 0x7F) << shift
 			wire |= (uint64(b) & 0x7F) << shift
 			if b < 0x80 {
 			if b < 0x80 {
@@ -201,7 +203,7 @@ func (m *TestOldDeviceID) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				byteLen |= (int(b) & 0x7F) << shift
 				byteLen |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -215,14 +217,14 @@ func (m *TestOldDeviceID) Unmarshal(data []byte) error {
 			if postIndex > l {
 			if postIndex > l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			m.Test = append(m.Test[:0], data[iNdEx:postIndex]...)
+			m.Test = append(m.Test[:0], dAtA[iNdEx:postIndex]...)
 			if m.Test == nil {
 			if m.Test == nil {
 				m.Test = []byte{}
 				m.Test = []byte{}
 			}
 			}
 			iNdEx = postIndex
 			iNdEx = postIndex
 		default:
 		default:
 			iNdEx = preIndex
 			iNdEx = preIndex
-			skippy, err := skipDeviceidTest(data[iNdEx:])
+			skippy, err := skipDeviceidTest(dAtA[iNdEx:])
 			if err != nil {
 			if err != nil {
 				return err
 				return err
 			}
 			}
@@ -241,8 +243,8 @@ func (m *TestOldDeviceID) Unmarshal(data []byte) error {
 	}
 	}
 	return nil
 	return nil
 }
 }
-func (m *TestNewDeviceID) Unmarshal(data []byte) error {
-	l := len(data)
+func (m *TestNewDeviceID) Unmarshal(dAtA []byte) error {
+	l := len(dAtA)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
 		preIndex := iNdEx
 		preIndex := iNdEx
@@ -254,7 +256,7 @@ func (m *TestNewDeviceID) Unmarshal(data []byte) error {
 			if iNdEx >= l {
 			if iNdEx >= l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			b := data[iNdEx]
+			b := dAtA[iNdEx]
 			iNdEx++
 			iNdEx++
 			wire |= (uint64(b) & 0x7F) << shift
 			wire |= (uint64(b) & 0x7F) << shift
 			if b < 0x80 {
 			if b < 0x80 {
@@ -282,7 +284,7 @@ func (m *TestNewDeviceID) Unmarshal(data []byte) error {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				byteLen |= (int(b) & 0x7F) << shift
 				byteLen |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -296,13 +298,13 @@ func (m *TestNewDeviceID) Unmarshal(data []byte) error {
 			if postIndex > l {
 			if postIndex > l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			if err := m.Test.Unmarshal(data[iNdEx:postIndex]); err != nil {
+			if err := m.Test.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
 				return err
 				return err
 			}
 			}
 			iNdEx = postIndex
 			iNdEx = postIndex
 		default:
 		default:
 			iNdEx = preIndex
 			iNdEx = preIndex
-			skippy, err := skipDeviceidTest(data[iNdEx:])
+			skippy, err := skipDeviceidTest(dAtA[iNdEx:])
 			if err != nil {
 			if err != nil {
 				return err
 				return err
 			}
 			}
@@ -321,8 +323,8 @@ func (m *TestNewDeviceID) Unmarshal(data []byte) error {
 	}
 	}
 	return nil
 	return nil
 }
 }
-func skipDeviceidTest(data []byte) (n int, err error) {
-	l := len(data)
+func skipDeviceidTest(dAtA []byte) (n int, err error) {
+	l := len(dAtA)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
 		var wire uint64
 		var wire uint64
@@ -333,7 +335,7 @@ func skipDeviceidTest(data []byte) (n int, err error) {
 			if iNdEx >= l {
 			if iNdEx >= l {
 				return 0, io.ErrUnexpectedEOF
 				return 0, io.ErrUnexpectedEOF
 			}
 			}
-			b := data[iNdEx]
+			b := dAtA[iNdEx]
 			iNdEx++
 			iNdEx++
 			wire |= (uint64(b) & 0x7F) << shift
 			wire |= (uint64(b) & 0x7F) << shift
 			if b < 0x80 {
 			if b < 0x80 {
@@ -351,7 +353,7 @@ func skipDeviceidTest(data []byte) (n int, err error) {
 					return 0, io.ErrUnexpectedEOF
 					return 0, io.ErrUnexpectedEOF
 				}
 				}
 				iNdEx++
 				iNdEx++
-				if data[iNdEx-1] < 0x80 {
+				if dAtA[iNdEx-1] < 0x80 {
 					break
 					break
 				}
 				}
 			}
 			}
@@ -368,7 +370,7 @@ func skipDeviceidTest(data []byte) (n int, err error) {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return 0, io.ErrUnexpectedEOF
 					return 0, io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				length |= (int(b) & 0x7F) << shift
 				length |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -391,7 +393,7 @@ func skipDeviceidTest(data []byte) (n int, err error) {
 					if iNdEx >= l {
 					if iNdEx >= l {
 						return 0, io.ErrUnexpectedEOF
 						return 0, io.ErrUnexpectedEOF
 					}
 					}
-					b := data[iNdEx]
+					b := dAtA[iNdEx]
 					iNdEx++
 					iNdEx++
 					innerWire |= (uint64(b) & 0x7F) << shift
 					innerWire |= (uint64(b) & 0x7F) << shift
 					if b < 0x80 {
 					if b < 0x80 {
@@ -402,7 +404,7 @@ func skipDeviceidTest(data []byte) (n int, err error) {
 				if innerWireType == 4 {
 				if innerWireType == 4 {
 					break
 					break
 				}
 				}
-				next, err := skipDeviceidTest(data[start:])
+				next, err := skipDeviceidTest(dAtA[start:])
 				if err != nil {
 				if err != nil {
 					return 0, err
 					return 0, err
 				}
 				}
@@ -426,17 +428,19 @@ var (
 	ErrIntOverflowDeviceidTest   = fmt.Errorf("proto: integer overflow")
 	ErrIntOverflowDeviceidTest   = fmt.Errorf("proto: integer overflow")
 )
 )
 
 
+func init() { proto.RegisterFile("deviceid_test.proto", fileDescriptorDeviceidTest) }
+
 var fileDescriptorDeviceidTest = []byte{
 var fileDescriptorDeviceidTest = []byte{
-	// 171 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x4e, 0x49, 0x2d, 0xcb,
+	// 176 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4e, 0x49, 0x2d, 0xcb,
 	0x4c, 0x4e, 0xcd, 0x4c, 0x89, 0x2f, 0x49, 0x2d, 0x2e, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17,
 	0x4c, 0x4e, 0xcd, 0x4c, 0x89, 0x2f, 0x49, 0x2d, 0x2e, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17,
 	0xe2, 0x00, 0x53, 0xc9, 0xf9, 0x39, 0x52, 0xba, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9,
 	0xe2, 0x00, 0x53, 0xc9, 0xf9, 0x39, 0x52, 0xba, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9,
 	0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0xe9, 0xf9, 0xfa, 0x60, 0x99, 0xa4, 0xd2, 0x34, 0x30, 0x0f, 0xcc,
 	0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0xe9, 0xf9, 0xfa, 0x60, 0x99, 0xa4, 0xd2, 0x34, 0x30, 0x0f, 0xcc,
-	0x01, 0xb3, 0x20, 0x1a, 0x95, 0x54, 0xb9, 0xf8, 0x43, 0x80, 0xc6, 0xf8, 0xe7, 0xa4, 0xb8, 0x80,
-	0x8d, 0xf5, 0x74, 0x11, 0x12, 0xe2, 0x62, 0x01, 0x99, 0x2c, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x13,
-	0x04, 0x66, 0x2b, 0x99, 0x43, 0x94, 0xf9, 0xa5, 0x96, 0xc3, 0x95, 0xa9, 0x20, 0x2b, 0x73, 0x12,
-	0x38, 0x71, 0x4f, 0x9e, 0xe1, 0xd6, 0x3d, 0x79, 0x0e, 0x98, 0x3c, 0x44, 0xa3, 0x93, 0xcc, 0x89,
-	0x87, 0x72, 0x0c, 0x17, 0x80, 0xf8, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x40, 0xfc, 0xe0, 0x91, 0x1c,
-	0xc3, 0x0b, 0x20, 0x5e, 0xf0, 0x58, 0x8e, 0x31, 0x89, 0x0d, 0xec, 0x08, 0x63, 0x40, 0x00, 0x00,
-	0x00, 0xff, 0xff, 0x35, 0x9c, 0x00, 0x78, 0xd4, 0x00, 0x00, 0x00,
+	0x01, 0xb3, 0x20, 0x1a, 0x95, 0x54, 0xb9, 0xf8, 0x43, 0x52, 0x8b, 0x4b, 0xfc, 0x73, 0x52, 0x5c,
+	0xc0, 0xc6, 0x7a, 0xba, 0x08, 0x09, 0x71, 0xb1, 0x80, 0x4c, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0,
+	0x09, 0x02, 0xb3, 0x95, 0xcc, 0x21, 0xca, 0xfc, 0x52, 0xcb, 0xe1, 0xca, 0x54, 0x90, 0x95, 0x39,
+	0x09, 0x9c, 0xb8, 0x27, 0xcf, 0x70, 0xeb, 0x9e, 0x3c, 0x07, 0x4c, 0x1e, 0xa2, 0xd1, 0x49, 0xe6,
+	0xc4, 0x43, 0x39, 0x86, 0x0b, 0x0f, 0xe5, 0x18, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e,
+	0xf1, 0xc1, 0x23, 0x39, 0x86, 0x17, 0x8f, 0xe4, 0x18, 0x16, 0x3c, 0x96, 0x63, 0x4c, 0x62, 0x03,
+	0x3b, 0xc2, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x35, 0x9c, 0x00, 0x78, 0xd4, 0x00, 0x00, 0x00,
 }
 }

+ 3 - 0
vendor/github.com/gogo/protobuf/.gitignore

@@ -0,0 +1,3 @@
+._*
+*.js
+*.js.map

+ 8 - 0
vendor/github.com/gogo/protobuf/.mailmap

@@ -0,0 +1,8 @@
+Walter Schulze	<[email protected]>	Walter Schulze <[email protected]>
+Walter Schulze	<[email protected]>	<[email protected]>
+Walter Schulze	<[email protected]>  awalterschulze <[email protected]>
+Walter Schulze	<[email protected]>	[email protected] <[email protected]>
+John Tuley		<[email protected]>			<[email protected]>
+Anton Povarov 	<[email protected]>	<[email protected]>
+Denis Smirnov 	<[email protected]> dennwc
+DongYun Kang    <[email protected]>		<[email protected]>

+ 25 - 0
vendor/github.com/gogo/protobuf/.travis.yml

@@ -0,0 +1,25 @@
+env:
+  - PROTOBUF_VERSION=2.6.1
+  - PROTOBUF_VERSION=3.0.2
+  - PROTOBUF_VERSION=3.1.0
+
+before_install:
+  - ./install-protobuf.sh
+  - PATH=/home/travis/bin:$PATH protoc --version
+
+script:
+  - PATH=/home/travis/bin:$PATH make buildserverall
+  - echo $TRAVIS_GO_VERSION
+  - if [ "$TRAVIS_GO_VERSION" == 1.7.1 ] && [[ "$PROTOBUF_VERSION" == 3.1.0 ]]; then ! git status --porcelain | read || (git status; git diff; exit 1); fi
+
+language: go
+
+go:
+  - 1.5.4
+  - 1.6.3
+  - 1.7.1
+
+matrix:
+  allow_failures:
+    - go: 1.5.4
+    - go: 1.6.3

+ 14 - 0
vendor/github.com/gogo/protobuf/AUTHORS

@@ -0,0 +1,14 @@
+# This is the official list of GoGo authors for copyright purposes.
+# This file is distinct from the CONTRIBUTORS file, which
+# lists people.  For example, employees are listed in CONTRIBUTORS,
+# but not in AUTHORS, because the employer holds the copyright.
+
+# Names should be added to this file as one of
+#     Organization's name
+#     Individual's name <submission email address>
+#     Individual's name <submission email address> <email2> <emailN>
+
+# Please keep the list sorted.
+
+Vastech SA (PTY) LTD
+Walter Schulze <[email protected]>

+ 16 - 0
vendor/github.com/gogo/protobuf/CONTRIBUTORS

@@ -0,0 +1,16 @@
+Anton Povarov <[email protected]>
+Clayton Coleman <[email protected]>
+Denis Smirnov <[email protected]>
+DongYun Kang <[email protected]>
+Dwayne Schultz <[email protected]>
+Georg Apitz <[email protected]>
+Gustav Paul <[email protected]>
+Johan Brandhorst <[email protected]>
+John Tuley <[email protected]>
+Laurent <[email protected]>
+Patrick Lee <[email protected]>
+Stephen J Day <[email protected]>
+Tamir Duberstein <[email protected]>
+Todd Eisenberger <[email protected]>
+Tormod Erevik Lea <[email protected]>
+Walter Schulze <[email protected]>

+ 5 - 0
vendor/github.com/gogo/protobuf/GOLANG_CONTRIBUTORS

@@ -0,0 +1,5 @@
+The contributors to the Go protobuf repository:
+
+# This source code was written by the Go contributors.
+# The master list of contributors is in the main Go distribution,
+# visible at http://tip.golang.org/CONTRIBUTORS.

+ 3 - 3
vendor/github.com/gogo/protobuf/LICENSE

@@ -1,7 +1,7 @@
-Extensions for Protocol Buffers to create more go like structures.
+Protocol Buffers for Go with Gadgets
 
 
-Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-http://github.com/gogo/protobuf/gogoproto
+Copyright (c) 2013, The GoGo Authors. All rights reserved.
+http://github.com/gogo/protobuf
 
 
 Go support for Protocol Buffers - Google's data interchange format
 Go support for Protocol Buffers - Google's data interchange format
 
 

+ 141 - 0
vendor/github.com/gogo/protobuf/Makefile

@@ -0,0 +1,141 @@
+# Protocol Buffers for Go with Gadgets
+#
+# Copyright (c) 2013, The GoGo Authors. All rights reserved.
+# http://github.com/gogo/protobuf
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+.PHONY: nuke regenerate tests clean install gofmt vet contributors
+
+all: clean install regenerate install tests errcheck vet
+
+buildserverall: clean install regenerate install tests vet js
+
+install:
+	go install ./proto
+	go install ./gogoproto
+	go install ./jsonpb
+	go install ./protoc-gen-gogo
+	go install ./protoc-gen-gofast
+	go install ./protoc-gen-gogofast
+	go install ./protoc-gen-gogofaster
+	go install ./protoc-gen-gogoslick
+	go install ./protoc-gen-gostring
+	go install ./protoc-min-version
+	go install ./protoc-gen-combo
+	go install ./gogoreplace
+
+clean:
+	go clean ./...
+
+nuke:
+	go clean -i ./...
+
+gofmt:
+	gofmt -l -s -w .
+
+regenerate:
+	make -C protoc-gen-gogo/descriptor regenerate
+	make -C protoc-gen-gogo/plugin regenerate
+	make -C protoc-gen-gogo/testdata regenerate
+	make -C gogoproto regenerate
+	make -C proto/testdata regenerate
+	make -C jsonpb/jsonpb_test_proto regenerate
+	make -C _conformance regenerate
+	make -C types regenerate
+	make -C test regenerate
+	make -C test/example regenerate
+	make -C test/unrecognized regenerate
+	make -C test/group regenerate
+	make -C test/unrecognizedgroup regenerate
+	make -C test/enumstringer regenerate
+	make -C test/unmarshalmerge regenerate
+	make -C test/moredefaults regenerate
+	make -C test/issue8 regenerate
+	make -C test/enumprefix regenerate
+	make -C test/enumcustomname regenerate
+	make -C test/packed regenerate
+	make -C test/protosize regenerate
+	make -C test/tags regenerate
+	make -C test/oneof regenerate
+	make -C test/oneof3 regenerate
+	make -C test/theproto3 regenerate
+	make -C test/mapsproto2 regenerate
+	make -C test/issue42order regenerate
+	make -C proto generate-test-pbs
+	make -C test/importdedup regenerate
+	make -C test/custombytesnonstruct regenerate
+	make -C test/required regenerate
+	make -C test/casttype regenerate
+	make -C test/castvalue regenerate
+	make -C vanity/test regenerate
+	make -C test/sizeunderscore regenerate
+	make -C test/issue34 regenerate
+	make -C test/empty-issue70 regenerate
+	make -C test/indeximport-issue72 regenerate
+	make -C test/fuzztests regenerate
+	make -C test/oneofembed regenerate
+	make -C test/asymetric-issue125 regenerate
+	make -C test/filedotname regenerate
+	make -C test/nopackage regenerate
+	make -C test/types regenerate
+	make -C test/proto3extension regenerate
+	make -C test/stdtypes regenerate
+	make -C test/data regenerate
+	make gofmt
+
+tests:
+	go build ./test/enumprefix
+	go test ./...
+
+vet:
+	go vet ./...
+	go tool vet --shadow .
+
+errcheck:
+	go get github.com/kisielk/errcheck
+	errcheck ./test/...
+
+drone:
+	sudo apt-get install protobuf-compiler
+	(cd $(GOPATH)/src/github.com/gogo/protobuf && make buildserverall)
+
+testall:
+	make -C protoc-gen-gogo/testdata test
+	make -C vanity/test test
+	make tests
+
+bench:
+	(cd test/mixbench && go build .)
+	(cd test/mixbench && ./mixbench)
+
+contributors:
+	git log --format='%aN <%aE>' | sort -fu > CONTRIBUTORS
+
+js:
+	go get github.com/gopherjs/gopherjs
+	gopherjs build github.com/gogo/protobuf/protoc-gen-gogo
+
+update:
+	(cd protobuf && make update)

+ 258 - 0
vendor/github.com/gogo/protobuf/README

@@ -0,0 +1,258 @@
+GoGoProtobuf http://github.com/gogo/protobuf extends 
+GoProtobuf http://github.com/golang/protobuf
+
+# Go support for Protocol Buffers
+
+Google's data interchange format.
+Copyright 2010 The Go Authors.
+https://github.com/golang/protobuf
+
+This package and the code it generates requires at least Go 1.4.
+
+This software implements Go bindings for protocol buffers.  For
+information about protocol buffers themselves, see
+	https://developers.google.com/protocol-buffers/
+
+## Installation ##
+
+To use this software, you must:
+- Install the standard C++ implementation of protocol buffers from
+	https://developers.google.com/protocol-buffers/
+- Of course, install the Go compiler and tools from
+	https://golang.org/
+  See
+	https://golang.org/doc/install
+  for details or, if you are using gccgo, follow the instructions at
+	https://golang.org/doc/install/gccgo
+- Grab the code from the repository and install the proto package.
+  The simplest way is to run `go get -u github.com/golang/protobuf/{proto,protoc-gen-go}`.
+  The compiler plugin, protoc-gen-go, will be installed in $GOBIN,
+  defaulting to $GOPATH/bin.  It must be in your $PATH for the protocol
+  compiler, protoc, to find it.
+
+This software has two parts: a 'protocol compiler plugin' that
+generates Go source files that, once compiled, can access and manage
+protocol buffers; and a library that implements run-time support for
+encoding (marshaling), decoding (unmarshaling), and accessing protocol
+buffers.
+
+There is support for gRPC in Go using protocol buffers.
+See the note at the bottom of this file for details.
+
+There are no insertion points in the plugin.
+
+GoGoProtobuf provides extensions for protocol buffers and GoProtobuf
+see http://github.com/gogo/protobuf/gogoproto/doc.go
+
+## Using protocol buffers with Go ##
+
+Once the software is installed, there are two steps to using it.
+First you must compile the protocol buffer definitions and then import
+them, with the support library, into your program.
+
+To compile the protocol buffer definition, run protoc with the --gogo_out
+parameter set to the directory you want to output the Go code to.
+
+	protoc --gogo_out=. *.proto
+
+The generated files will be suffixed .pb.go.  See the Test code below
+for an example using such a file.
+
+The package comment for the proto library contains text describing
+the interface provided in Go for protocol buffers. Here is an edited
+version.
+
+If you are using any gogo.proto extensions you will need to specify the
+proto_path to include the descriptor.proto and gogo.proto.
+gogo.proto is located in github.com/gogo/protobuf/gogoproto
+This should be fine, since your import is the same.
+descriptor.proto is located in either github.com/gogo/protobuf/protobuf
+or code.google.com/p/protobuf/trunk/src/
+Its import is google/protobuf/descriptor.proto so it might need some help.
+
+	protoc --gogo_out=. -I=.:github.com/gogo/protobuf/protobuf *.proto
+
+==========
+
+The proto package converts data structures to and from the
+wire format of protocol buffers.  It works in concert with the
+Go source code generated for .proto files by the protocol compiler.
+
+A summary of the properties of the protocol buffer interface
+for a protocol buffer variable v:
+
+  - Names are turned from camel_case to CamelCase for export.
+  - There are no methods on v to set fields; just treat
+  	them as structure fields.
+  - There are getters that return a field's value if set,
+	and return the field's default value if unset.
+	The getters work even if the receiver is a nil message.
+  - The zero value for a struct is its correct initialization state.
+	All desired fields must be set before marshaling.
+  - A Reset() method will restore a protobuf struct to its zero state.
+  - Non-repeated fields are pointers to the values; nil means unset.
+	That is, optional or required field int32 f becomes F *int32.
+  - Repeated fields are slices.
+  - Helper functions are available to aid the setting of fields.
+	Helpers for getting values are superseded by the
+	GetFoo methods and their use is deprecated.
+		msg.Foo = proto.String("hello") // set field
+  - Constants are defined to hold the default values of all fields that
+	have them.  They have the form Default_StructName_FieldName.
+	Because the getter methods handle defaulted values,
+	direct use of these constants should be rare.
+  - Enums are given type names and maps from names to values.
+	Enum values are prefixed with the enum's type name. Enum types have
+	a String method, and a Enum method to assist in message construction.
+  - Nested groups and enums have type names prefixed with the name of
+  	the surrounding message type.
+  - Extensions are given descriptor names that start with E_,
+	followed by an underscore-delimited list of the nested messages
+	that contain it (if any) followed by the CamelCased name of the
+	extension field itself.  HasExtension, ClearExtension, GetExtension
+	and SetExtension are functions for manipulating extensions.
+  - Oneof field sets are given a single field in their message,
+	with distinguished wrapper types for each possible field value.
+  - Marshal and Unmarshal are functions to encode and decode the wire format.
+
+When the .proto file specifies `syntax="proto3"`, there are some differences:
+
+  - Non-repeated fields of non-message type are values instead of pointers.
+  - Getters are only generated for message and oneof fields.
+  - Enum types do not get an Enum method.
+
+Consider file test.proto, containing
+
+```proto
+	package example;
+	
+	enum FOO { X = 17; };
+	
+	message Test {
+	  required string label = 1;
+	  optional int32 type = 2 [default=77];
+	  repeated int64 reps = 3;
+	  optional group OptionalGroup = 4 {
+	    required string RequiredField = 5;
+	  }
+	}
+```
+
+To create and play with a Test object from the example package,
+
+```go
+	package main
+
+	import (
+		"log"
+
+		"github.com/gogo/protobuf/proto"
+		"path/to/example"
+	)
+
+	func main() {
+		test := &example.Test {
+			Label: proto.String("hello"),
+			Type:  proto.Int32(17),
+			Reps:  []int64{1, 2, 3},
+			Optionalgroup: &example.Test_OptionalGroup {
+				RequiredField: proto.String("good bye"),
+			},
+		}
+		data, err := proto.Marshal(test)
+		if err != nil {
+			log.Fatal("marshaling error: ", err)
+		}
+		newTest := &example.Test{}
+		err = proto.Unmarshal(data, newTest)
+		if err != nil {
+			log.Fatal("unmarshaling error: ", err)
+		}
+		// Now test and newTest contain the same data.
+		if test.GetLabel() != newTest.GetLabel() {
+			log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel())
+		}
+		// etc.
+	}
+```
+
+
+## Parameters ##
+
+To pass extra parameters to the plugin, use a comma-separated
+parameter list separated from the output directory by a colon:
+
+
+	protoc --gogo_out=plugins=grpc,import_path=mypackage:. *.proto
+
+
+- `import_prefix=xxx` - a prefix that is added onto the beginning of
+  all imports. Useful for things like generating protos in a
+  subdirectory, or regenerating vendored protobufs in-place.
+- `import_path=foo/bar` - used as the package if no input files
+  declare `go_package`. If it contains slashes, everything up to the
+  rightmost slash is ignored.
+- `plugins=plugin1+plugin2` - specifies the list of sub-plugins to
+  load. The only plugin in this repo is `grpc`.
+- `Mfoo/bar.proto=quux/shme` - declares that foo/bar.proto is
+  associated with Go package quux/shme.  This is subject to the
+  import_prefix parameter.
+
+## gRPC Support ##
+
+If a proto file specifies RPC services, protoc-gen-go can be instructed to
+generate code compatible with gRPC (http://www.grpc.io/). To do this, pass
+the `plugins` parameter to protoc-gen-go; the usual way is to insert it into
+the --go_out argument to protoc:
+
+	protoc --gogo_out=plugins=grpc:. *.proto
+
+## Compatibility ##
+
+The library and the generated code are expected to be stable over time.
+However, we reserve the right to make breaking changes without notice for the
+following reasons:
+
+- Security. A security issue in the specification or implementation may come to
+  light whose resolution requires breaking compatibility. We reserve the right
+  to address such security issues.
+- Unspecified behavior.  There are some aspects of the Protocol Buffers
+  specification that are undefined.  Programs that depend on such unspecified
+  behavior may break in future releases.
+- Specification errors or changes. If it becomes necessary to address an
+  inconsistency, incompleteness, or change in the Protocol Buffers
+  specification, resolving the issue could affect the meaning or legality of
+  existing programs.  We reserve the right to address such issues, including
+  updating the implementations.
+- Bugs.  If the library has a bug that violates the specification, a program
+  that depends on the buggy behavior may break if the bug is fixed.  We reserve
+  the right to fix such bugs.
+- Adding methods or fields to generated structs.  These may conflict with field
+  names that already exist in a schema, causing applications to break.  When the
+  code generator encounters a field in the schema that would collide with a
+  generated field or method name, the code generator will append an underscore
+  to the generated field or method name.
+- Adding, removing, or changing methods or fields in generated structs that
+  start with `XXX`.  These parts of the generated code are exported out of
+  necessity, but should not be considered part of the public API.
+- Adding, removing, or changing unexported symbols in generated code.
+
+Any breaking changes outside of these will be announced 6 months in advance to
[email protected].
+
+You should, whenever possible, use generated code created by the `protoc-gen-go`
+tool built at the same commit as the `proto` package.  The `proto` package
+declares package-level constants in the form `ProtoPackageIsVersionX`.
+Application code and generated code may depend on one of these constants to
+ensure that compilation will fail if the available version of the proto library
+is too old.  Whenever we make a change to the generated code that requires newer
+library support, in the same commit we will increment the version number of the
+generated code and declare a new package-level constant whose name incorporates
+the latest version number.  Removing a compatibility constant is considered a
+breaking change and would be subject to the announcement policy stated above.
+
+## Plugins ##
+
+The `protoc-gen-go/generator` package exposes a plugin interface,
+which is used by the gRPC code generation. This interface is not
+supported and is subject to incompatible changes without notice.

+ 116 - 0
vendor/github.com/gogo/protobuf/Readme.md

@@ -0,0 +1,116 @@
+# Protocol Buffers for Go with Gadgets
+
+[![Build Status](https://travis-ci.org/gogo/protobuf.svg?branch=master)](https://travis-ci.org/gogo/protobuf)
+
+gogoprotobuf is a fork of <a href="https://github.com/golang/protobuf">golang/protobuf</a> with extra code generation features.
+
+This code generation is used to achieve:
+  
+  - fast marshalling and unmarshalling
+  - more canonical Go structures
+  - goprotobuf compatibility
+  - less typing by optionally generating extra helper code
+  - peace of mind by optionally generating test and benchmark code
+  - other serialization formats
+
+Keeping track of how up to date gogoprotobuf is relative to golang/protobuf is done in this
+<a href="https://github.com/gogo/protobuf/issues/191">issue</a>
+
+## Users
+
+These projects use gogoprotobuf:
+
+  - <a href="http://godoc.org/github.com/coreos/etcd">etcd</a> - <a href="https://blog.gopheracademy.com/advent-2015/etcd-distributed-key-value-store-with-grpc-http2/">blog</a> - <a href="https://github.com/coreos/etcd/blob/master/etcdserver/etcdserverpb/etcdserver.proto">sample proto file</a>
+  - <a href="https://www.spacemonkey.com/">spacemonkey</a> - <a href="https://www.spacemonkey.com/blog/posts/go-space-monkey">blog</a>
+  - <a href="http://badoo.com">badoo</a> - <a href="https://github.com/badoo/lsd/blob/32061f501c5eca9c76c596d790b450501ba27b2f/proto/lsd.proto">sample proto file</a>
+  - <a href="https://github.com/mesos/mesos-go">mesos-go</a> - <a href="https://github.com/mesos/mesos-go/blob/master/mesosproto/mesos.proto">sample proto file</a>
+  - <a href="https://github.com/mozilla-services/heka">heka</a> - <a href="https://github.com/mozilla-services/heka/commit/eb72fbf7d2d28249fbaf8d8dc6607f4eb6f03351">the switch from golang/protobuf to gogo/protobuf when it was still on code.google.com</a>
+  - <a href="https://github.com/cockroachdb/cockroach">cockroachdb</a> - <a href="https://github.com/cockroachdb/cockroach/blob/651d54d393e391a30154e9117ab4b18d9ee6d845/roachpb/metadata.proto">sample proto file</a>
+  - <a href="https://github.com/jbenet/go-ipfs">go-ipfs</a> - <a href="https://github.com/ipfs/go-ipfs/blob/2b6da0c024f28abeb16947fb452787196a6b56a2/merkledag/pb/merkledag.proto">sample proto file</a>
+  - <a href="https://github.com/philhofer/rkive">rkive-go</a> - <a href="https://github.com/philhofer/rkive/blob/e5dd884d3ea07b341321073882ae28aa16dd11be/rpbc/riak_dt.proto">sample proto file</a>
+  - <a href="https://www.dropbox.com">dropbox</a>
+  - <a href="https://srclib.org/">srclib</a> - <a href="https://github.com/sourcegraph/srclib/blob/6538858f0c410cac5c63440317b8d009e889d3fb/graph/def.proto">sample proto file</a>
+  - <a href="http://www.adyoulike.com/">adyoulike</a>
+  - <a href="http://www.cloudfoundry.org/">cloudfoundry</a> - <a href="https://github.com/cloudfoundry/bbs/blob/d673710b8c4211037805129944ee4c5373d6588a/models/events.proto">sample proto file</a>
+  - <a href="http://kubernetes.io/">kubernetes</a> - <a href="https://github.com/kubernetes/kubernetes/tree/88d8628137f94ee816aaa6606ae8cd045dee0bff/cmd/libs/go2idl">go2idl built on top of gogoprotobuf</a>
+  - <a href="https://dgraph.io/">dgraph</a> - <a href="https://github.com/dgraph-io/dgraph/releases/tag/v0.4.3">release notes</a> - <a href="https://discuss.dgraph.io/t/gogoprotobuf-is-extremely-fast/639">benchmarks</a></a>
+  - <a href="https://github.com/centrifugal/centrifugo">centrifugo</a> - <a href="https://forum.golangbridge.org/t/centrifugo-real-time-messaging-websocket-or-sockjs-server-v1-5-0-released/2861">release notes</a> - <a href="https://medium.com/@fzambia/centrifugo-protobuf-inside-json-outside-21d39bdabd68#.o3icmgjqd">blog</a>
+  - <a href="https://github.com/docker/swarmkit">docker swarmkit</a> - <a href="https://github.com/docker/swarmkit/blob/63600e01af3b8da2a0ed1c9fa6e1ae4299d75edb/api/objects.proto">sample proto file</a>
+  - <a href="https://nats.io/">nats.io</a> - <a href="https://github.com/nats-io/go-nats-streaming/blob/master/pb/protocol.proto">go-nats-streaming</a>
+  - <a href="https://github.com/pingcap/tidb">tidb</a> - Communication between <a href="https://github.com/pingcap/tipb/blob/master/generate-go.sh#L4">tidb</a> and <a href="https://github.com/pingcap/kvproto/blob/master/generate_go.sh#L3">tikv</a>
+
+Please lets us know if you are using gogoprotobuf by posting on our <a href="https://groups.google.com/forum/#!topic/gogoprotobuf/Brw76BxmFpQ">GoogleGroup</a>.
+
+### Mentioned
+
+  - <a href="http://www.slideshare.net/albertstrasheim/serialization-in-go">Cloudflare - go serialization talk - Albert Strasheim</a>
+  - <a href="http://gophercon.sourcegraph.com/post/83747547505/writing-a-high-performance-database-in-go">gophercon</a>
+  - <a href="https://github.com/alecthomas/go_serialization_benchmarks">alecthomas' go serialization benchmarks</a>
+
+## Getting Started 
+
+There are several ways to use gogoprotobuf, but for all you need to install go and protoc.
+After that you can choose:
+ 
+  - Speed
+  - More Speed and more generated code
+  - Most Speed and most customization
+
+### Installation
+
+To install it, you must first have Go (at least version 1.3.3) installed (see [http://golang.org/doc/install](http://golang.org/doc/install)).  Go 1.7.1 is continuously tested.
+
+Next, install the standard protocol buffer implementation from [https://github.com/google/protobuf](https://github.com/google/protobuf).
+Most versions from 2.3.1 should not give any problems, but 2.6.1, 3.0.2 and 3.1.0 are continuously tested.
+
+### Speed
+
+Install the protoc-gen-gofast binary
+
+    go get github.com/gogo/protobuf/protoc-gen-gofast
+
+Use it to generate faster marshaling and unmarshaling go code for your protocol buffers.
+
+    protoc --gofast_out=. myproto.proto
+
+This does not allow you to use any of the other gogoprotobuf [extensions](https://github.com/gogo/protobuf/blob/master/extensions.md).
+
+### More Speed and more generated code
+
+Fields without pointers cause less time in the garbage collector.
+More code generation results in more convenient methods.
+
+Other binaries are also included:
+
+    protoc-gen-gogofast (same as gofast, but imports gogoprotobuf)
+    protoc-gen-gogofaster (same as gogofast, without XXX_unrecognized, less pointer fields)
+    protoc-gen-gogoslick (same as gogofaster, but with generated string, gostring and equal methods)
+
+Installing any of these binaries is easy.  Simply run:
+
+    go get github.com/gogo/protobuf/proto
+    go get github.com/gogo/protobuf/{binary}
+    go get github.com/gogo/protobuf/gogoproto
+
+These binaries allow you to using gogoprotobuf [extensions](https://github.com/gogo/protobuf/blob/master/extensions.md).
+
+### Most Speed and most customization
+
+Customizing the fields of the messages to be the fields that you actually want to use removes the need to copy between the structs you use and structs you use to serialize.
+gogoprotobuf also offers more serialization formats and generation of tests and even more methods.
+
+Please visit the [extensions](https://github.com/gogo/protobuf/blob/master/extensions.md) page for more documentation.
+
+Install protoc-gen-gogo:
+
+    go get github.com/gogo/protobuf/proto
+    go get github.com/gogo/protobuf/jsonpb
+    go get github.com/gogo/protobuf/protoc-gen-gogo
+    go get github.com/gogo/protobuf/gogoproto
+
+## GRPC
+
+It works the same as golang/protobuf, simply specify the plugin.
+Here is an example using gofast:
+
+    protoc --gofast_out=plugins=grpc:. my.proto

+ 40 - 0
vendor/github.com/gogo/protobuf/_conformance/Makefile

@@ -0,0 +1,40 @@
+# Go support for Protocol Buffers - Google's data interchange format
+#
+# Copyright 2016 The Go Authors.  All rights reserved.
+# https://github.com/golang/protobuf
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+regenerate:
+	protoc-min-version --version="3.0.0" --proto_path=$(GOPATH)/src:$(GOPATH)/src/github.com/gogo/protobuf/protobuf:. --gogo_out=\
+	Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,\
+	Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\
+	Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types,\
+	Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\
+	Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,\
+	Mgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types\
+	:. conformance_proto/conformance.proto

+ 161 - 0
vendor/github.com/gogo/protobuf/_conformance/conformance.go

@@ -0,0 +1,161 @@
+// Go support for Protocol Buffers - Google's data interchange format
+//
+// Copyright 2016 The Go Authors.  All rights reserved.
+// https://github.com/golang/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// conformance implements the conformance test subprocess protocol as
+// documented in conformance.proto.
+package main
+
+import (
+	"encoding/binary"
+	"fmt"
+	"io"
+	"os"
+
+	pb "github.com/gogo/protobuf/_conformance/conformance_proto"
+	"github.com/gogo/protobuf/jsonpb"
+	"github.com/gogo/protobuf/proto"
+)
+
+func main() {
+	var sizeBuf [4]byte
+	inbuf := make([]byte, 0, 4096)
+	outbuf := proto.NewBuffer(nil)
+	for {
+		if _, err := io.ReadFull(os.Stdin, sizeBuf[:]); err == io.EOF {
+			break
+		} else if err != nil {
+			fmt.Fprintln(os.Stderr, "go conformance: read request:", err)
+			os.Exit(1)
+		}
+		size := binary.LittleEndian.Uint32(sizeBuf[:])
+		if int(size) > cap(inbuf) {
+			inbuf = make([]byte, size)
+		}
+		inbuf = inbuf[:size]
+		if _, err := io.ReadFull(os.Stdin, inbuf); err != nil {
+			fmt.Fprintln(os.Stderr, "go conformance: read request:", err)
+			os.Exit(1)
+		}
+
+		req := new(pb.ConformanceRequest)
+		if err := proto.Unmarshal(inbuf, req); err != nil {
+			fmt.Fprintln(os.Stderr, "go conformance: parse request:", err)
+			os.Exit(1)
+		}
+		res := handle(req)
+
+		if err := outbuf.Marshal(res); err != nil {
+			fmt.Fprintln(os.Stderr, "go conformance: marshal response:", err)
+			os.Exit(1)
+		}
+		binary.LittleEndian.PutUint32(sizeBuf[:], uint32(len(outbuf.Bytes())))
+		if _, err := os.Stdout.Write(sizeBuf[:]); err != nil {
+			fmt.Fprintln(os.Stderr, "go conformance: write response:", err)
+			os.Exit(1)
+		}
+		if _, err := os.Stdout.Write(outbuf.Bytes()); err != nil {
+			fmt.Fprintln(os.Stderr, "go conformance: write response:", err)
+			os.Exit(1)
+		}
+		outbuf.Reset()
+	}
+}
+
+var jsonMarshaler = jsonpb.Marshaler{
+	OrigName: true,
+}
+
+func handle(req *pb.ConformanceRequest) *pb.ConformanceResponse {
+	var err error
+	var msg pb.TestAllTypes
+	switch p := req.Payload.(type) {
+	case *pb.ConformanceRequest_ProtobufPayload:
+		err = proto.Unmarshal(p.ProtobufPayload, &msg)
+	case *pb.ConformanceRequest_JsonPayload:
+		err = jsonpb.UnmarshalString(p.JsonPayload, &msg)
+		if err != nil && err.Error() == "unmarshaling Any not supported yet" {
+			return &pb.ConformanceResponse{
+				Result: &pb.ConformanceResponse_Skipped{
+					Skipped: err.Error(),
+				},
+			}
+		}
+	default:
+		return &pb.ConformanceResponse{
+			Result: &pb.ConformanceResponse_RuntimeError{
+				RuntimeError: "unknown request payload type",
+			},
+		}
+	}
+	if err != nil {
+		return &pb.ConformanceResponse{
+			Result: &pb.ConformanceResponse_ParseError{
+				ParseError: err.Error(),
+			},
+		}
+	}
+	switch req.RequestedOutputFormat {
+	case pb.WireFormat_PROTOBUF:
+		p, err := proto.Marshal(&msg)
+		if err != nil {
+			return &pb.ConformanceResponse{
+				Result: &pb.ConformanceResponse_SerializeError{
+					SerializeError: err.Error(),
+				},
+			}
+		}
+		return &pb.ConformanceResponse{
+			Result: &pb.ConformanceResponse_ProtobufPayload{
+				ProtobufPayload: p,
+			},
+		}
+	case pb.WireFormat_JSON:
+		p, err := jsonMarshaler.MarshalToString(&msg)
+		if err != nil {
+			return &pb.ConformanceResponse{
+				Result: &pb.ConformanceResponse_SerializeError{
+					SerializeError: err.Error(),
+				},
+			}
+		}
+		return &pb.ConformanceResponse{
+			Result: &pb.ConformanceResponse_JsonPayload{
+				JsonPayload: p,
+			},
+		}
+	default:
+		return &pb.ConformanceResponse{
+			Result: &pb.ConformanceResponse_RuntimeError{
+				RuntimeError: "unknown output format",
+			},
+		}
+	}
+}

+ 1890 - 0
vendor/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.pb.go

@@ -0,0 +1,1890 @@
+// Code generated by protoc-gen-gogo.
+// source: conformance_proto/conformance.proto
+// DO NOT EDIT!
+
+/*
+Package conformance is a generated protocol buffer package.
+
+It is generated from these files:
+	conformance_proto/conformance.proto
+
+It has these top-level messages:
+	ConformanceRequest
+	ConformanceResponse
+	TestAllTypes
+	ForeignMessage
+*/
+package conformance
+
+import proto "github.com/gogo/protobuf/proto"
+import fmt "fmt"
+import math "math"
+import google_protobuf "github.com/gogo/protobuf/types"
+import google_protobuf1 "github.com/gogo/protobuf/types"
+import google_protobuf2 "github.com/gogo/protobuf/types"
+import google_protobuf3 "github.com/gogo/protobuf/types"
+import google_protobuf4 "github.com/gogo/protobuf/types"
+import google_protobuf5 "github.com/gogo/protobuf/types"
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
+
+type WireFormat int32
+
+const (
+	WireFormat_UNSPECIFIED WireFormat = 0
+	WireFormat_PROTOBUF    WireFormat = 1
+	WireFormat_JSON        WireFormat = 2
+)
+
+var WireFormat_name = map[int32]string{
+	0: "UNSPECIFIED",
+	1: "PROTOBUF",
+	2: "JSON",
+}
+var WireFormat_value = map[string]int32{
+	"UNSPECIFIED": 0,
+	"PROTOBUF":    1,
+	"JSON":        2,
+}
+
+func (x WireFormat) String() string {
+	return proto.EnumName(WireFormat_name, int32(x))
+}
+func (WireFormat) EnumDescriptor() ([]byte, []int) { return fileDescriptorConformance, []int{0} }
+
+type ForeignEnum int32
+
+const (
+	ForeignEnum_FOREIGN_FOO ForeignEnum = 0
+	ForeignEnum_FOREIGN_BAR ForeignEnum = 1
+	ForeignEnum_FOREIGN_BAZ ForeignEnum = 2
+)
+
+var ForeignEnum_name = map[int32]string{
+	0: "FOREIGN_FOO",
+	1: "FOREIGN_BAR",
+	2: "FOREIGN_BAZ",
+}
+var ForeignEnum_value = map[string]int32{
+	"FOREIGN_FOO": 0,
+	"FOREIGN_BAR": 1,
+	"FOREIGN_BAZ": 2,
+}
+
+func (x ForeignEnum) String() string {
+	return proto.EnumName(ForeignEnum_name, int32(x))
+}
+func (ForeignEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptorConformance, []int{1} }
+
+type TestAllTypes_NestedEnum int32
+
+const (
+	TestAllTypes_FOO TestAllTypes_NestedEnum = 0
+	TestAllTypes_BAR TestAllTypes_NestedEnum = 1
+	TestAllTypes_BAZ TestAllTypes_NestedEnum = 2
+	TestAllTypes_NEG TestAllTypes_NestedEnum = -1
+)
+
+var TestAllTypes_NestedEnum_name = map[int32]string{
+	0:  "FOO",
+	1:  "BAR",
+	2:  "BAZ",
+	-1: "NEG",
+}
+var TestAllTypes_NestedEnum_value = map[string]int32{
+	"FOO": 0,
+	"BAR": 1,
+	"BAZ": 2,
+	"NEG": -1,
+}
+
+func (x TestAllTypes_NestedEnum) String() string {
+	return proto.EnumName(TestAllTypes_NestedEnum_name, int32(x))
+}
+func (TestAllTypes_NestedEnum) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptorConformance, []int{2, 0}
+}
+
+// Represents a single test case's input.  The testee should:
+//
+//   1. parse this proto (which should always succeed)
+//   2. parse the protobuf or JSON payload in "payload" (which may fail)
+//   3. if the parse succeeded, serialize the message in the requested format.
+type ConformanceRequest struct {
+	// The payload (whether protobuf of JSON) is always for a TestAllTypes proto
+	// (see below).
+	//
+	// Types that are valid to be assigned to Payload:
+	//	*ConformanceRequest_ProtobufPayload
+	//	*ConformanceRequest_JsonPayload
+	Payload isConformanceRequest_Payload `protobuf_oneof:"payload"`
+	// Which format should the testee serialize its message to?
+	RequestedOutputFormat WireFormat `protobuf:"varint,3,opt,name=requested_output_format,json=requestedOutputFormat,proto3,enum=conformance.WireFormat" json:"requested_output_format,omitempty"`
+}
+
+func (m *ConformanceRequest) Reset()                    { *m = ConformanceRequest{} }
+func (m *ConformanceRequest) String() string            { return proto.CompactTextString(m) }
+func (*ConformanceRequest) ProtoMessage()               {}
+func (*ConformanceRequest) Descriptor() ([]byte, []int) { return fileDescriptorConformance, []int{0} }
+
+type isConformanceRequest_Payload interface {
+	isConformanceRequest_Payload()
+}
+
+type ConformanceRequest_ProtobufPayload struct {
+	ProtobufPayload []byte `protobuf:"bytes,1,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"`
+}
+type ConformanceRequest_JsonPayload struct {
+	JsonPayload string `protobuf:"bytes,2,opt,name=json_payload,json=jsonPayload,proto3,oneof"`
+}
+
+func (*ConformanceRequest_ProtobufPayload) isConformanceRequest_Payload() {}
+func (*ConformanceRequest_JsonPayload) isConformanceRequest_Payload()     {}
+
+func (m *ConformanceRequest) GetPayload() isConformanceRequest_Payload {
+	if m != nil {
+		return m.Payload
+	}
+	return nil
+}
+
+func (m *ConformanceRequest) GetProtobufPayload() []byte {
+	if x, ok := m.GetPayload().(*ConformanceRequest_ProtobufPayload); ok {
+		return x.ProtobufPayload
+	}
+	return nil
+}
+
+func (m *ConformanceRequest) GetJsonPayload() string {
+	if x, ok := m.GetPayload().(*ConformanceRequest_JsonPayload); ok {
+		return x.JsonPayload
+	}
+	return ""
+}
+
+func (m *ConformanceRequest) GetRequestedOutputFormat() WireFormat {
+	if m != nil {
+		return m.RequestedOutputFormat
+	}
+	return WireFormat_UNSPECIFIED
+}
+
+// XXX_OneofFuncs is for the internal use of the proto package.
+func (*ConformanceRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
+	return _ConformanceRequest_OneofMarshaler, _ConformanceRequest_OneofUnmarshaler, _ConformanceRequest_OneofSizer, []interface{}{
+		(*ConformanceRequest_ProtobufPayload)(nil),
+		(*ConformanceRequest_JsonPayload)(nil),
+	}
+}
+
+func _ConformanceRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
+	m := msg.(*ConformanceRequest)
+	// payload
+	switch x := m.Payload.(type) {
+	case *ConformanceRequest_ProtobufPayload:
+		_ = b.EncodeVarint(1<<3 | proto.WireBytes)
+		_ = b.EncodeRawBytes(x.ProtobufPayload)
+	case *ConformanceRequest_JsonPayload:
+		_ = b.EncodeVarint(2<<3 | proto.WireBytes)
+		_ = b.EncodeStringBytes(x.JsonPayload)
+	case nil:
+	default:
+		return fmt.Errorf("ConformanceRequest.Payload has unexpected type %T", x)
+	}
+	return nil
+}
+
+func _ConformanceRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
+	m := msg.(*ConformanceRequest)
+	switch tag {
+	case 1: // payload.protobuf_payload
+		if wire != proto.WireBytes {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeRawBytes(true)
+		m.Payload = &ConformanceRequest_ProtobufPayload{x}
+		return true, err
+	case 2: // payload.json_payload
+		if wire != proto.WireBytes {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeStringBytes()
+		m.Payload = &ConformanceRequest_JsonPayload{x}
+		return true, err
+	default:
+		return false, nil
+	}
+}
+
+func _ConformanceRequest_OneofSizer(msg proto.Message) (n int) {
+	m := msg.(*ConformanceRequest)
+	// payload
+	switch x := m.Payload.(type) {
+	case *ConformanceRequest_ProtobufPayload:
+		n += proto.SizeVarint(1<<3 | proto.WireBytes)
+		n += proto.SizeVarint(uint64(len(x.ProtobufPayload)))
+		n += len(x.ProtobufPayload)
+	case *ConformanceRequest_JsonPayload:
+		n += proto.SizeVarint(2<<3 | proto.WireBytes)
+		n += proto.SizeVarint(uint64(len(x.JsonPayload)))
+		n += len(x.JsonPayload)
+	case nil:
+	default:
+		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
+	}
+	return n
+}
+
+// Represents a single test case's output.
+type ConformanceResponse struct {
+	// Types that are valid to be assigned to Result:
+	//	*ConformanceResponse_ParseError
+	//	*ConformanceResponse_SerializeError
+	//	*ConformanceResponse_RuntimeError
+	//	*ConformanceResponse_ProtobufPayload
+	//	*ConformanceResponse_JsonPayload
+	//	*ConformanceResponse_Skipped
+	Result isConformanceResponse_Result `protobuf_oneof:"result"`
+}
+
+func (m *ConformanceResponse) Reset()                    { *m = ConformanceResponse{} }
+func (m *ConformanceResponse) String() string            { return proto.CompactTextString(m) }
+func (*ConformanceResponse) ProtoMessage()               {}
+func (*ConformanceResponse) Descriptor() ([]byte, []int) { return fileDescriptorConformance, []int{1} }
+
+type isConformanceResponse_Result interface {
+	isConformanceResponse_Result()
+}
+
+type ConformanceResponse_ParseError struct {
+	ParseError string `protobuf:"bytes,1,opt,name=parse_error,json=parseError,proto3,oneof"`
+}
+type ConformanceResponse_SerializeError struct {
+	SerializeError string `protobuf:"bytes,6,opt,name=serialize_error,json=serializeError,proto3,oneof"`
+}
+type ConformanceResponse_RuntimeError struct {
+	RuntimeError string `protobuf:"bytes,2,opt,name=runtime_error,json=runtimeError,proto3,oneof"`
+}
+type ConformanceResponse_ProtobufPayload struct {
+	ProtobufPayload []byte `protobuf:"bytes,3,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"`
+}
+type ConformanceResponse_JsonPayload struct {
+	JsonPayload string `protobuf:"bytes,4,opt,name=json_payload,json=jsonPayload,proto3,oneof"`
+}
+type ConformanceResponse_Skipped struct {
+	Skipped string `protobuf:"bytes,5,opt,name=skipped,proto3,oneof"`
+}
+
+func (*ConformanceResponse_ParseError) isConformanceResponse_Result()      {}
+func (*ConformanceResponse_SerializeError) isConformanceResponse_Result()  {}
+func (*ConformanceResponse_RuntimeError) isConformanceResponse_Result()    {}
+func (*ConformanceResponse_ProtobufPayload) isConformanceResponse_Result() {}
+func (*ConformanceResponse_JsonPayload) isConformanceResponse_Result()     {}
+func (*ConformanceResponse_Skipped) isConformanceResponse_Result()         {}
+
+func (m *ConformanceResponse) GetResult() isConformanceResponse_Result {
+	if m != nil {
+		return m.Result
+	}
+	return nil
+}
+
+func (m *ConformanceResponse) GetParseError() string {
+	if x, ok := m.GetResult().(*ConformanceResponse_ParseError); ok {
+		return x.ParseError
+	}
+	return ""
+}
+
+func (m *ConformanceResponse) GetSerializeError() string {
+	if x, ok := m.GetResult().(*ConformanceResponse_SerializeError); ok {
+		return x.SerializeError
+	}
+	return ""
+}
+
+func (m *ConformanceResponse) GetRuntimeError() string {
+	if x, ok := m.GetResult().(*ConformanceResponse_RuntimeError); ok {
+		return x.RuntimeError
+	}
+	return ""
+}
+
+func (m *ConformanceResponse) GetProtobufPayload() []byte {
+	if x, ok := m.GetResult().(*ConformanceResponse_ProtobufPayload); ok {
+		return x.ProtobufPayload
+	}
+	return nil
+}
+
+func (m *ConformanceResponse) GetJsonPayload() string {
+	if x, ok := m.GetResult().(*ConformanceResponse_JsonPayload); ok {
+		return x.JsonPayload
+	}
+	return ""
+}
+
+func (m *ConformanceResponse) GetSkipped() string {
+	if x, ok := m.GetResult().(*ConformanceResponse_Skipped); ok {
+		return x.Skipped
+	}
+	return ""
+}
+
+// XXX_OneofFuncs is for the internal use of the proto package.
+func (*ConformanceResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
+	return _ConformanceResponse_OneofMarshaler, _ConformanceResponse_OneofUnmarshaler, _ConformanceResponse_OneofSizer, []interface{}{
+		(*ConformanceResponse_ParseError)(nil),
+		(*ConformanceResponse_SerializeError)(nil),
+		(*ConformanceResponse_RuntimeError)(nil),
+		(*ConformanceResponse_ProtobufPayload)(nil),
+		(*ConformanceResponse_JsonPayload)(nil),
+		(*ConformanceResponse_Skipped)(nil),
+	}
+}
+
+func _ConformanceResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
+	m := msg.(*ConformanceResponse)
+	// result
+	switch x := m.Result.(type) {
+	case *ConformanceResponse_ParseError:
+		_ = b.EncodeVarint(1<<3 | proto.WireBytes)
+		_ = b.EncodeStringBytes(x.ParseError)
+	case *ConformanceResponse_SerializeError:
+		_ = b.EncodeVarint(6<<3 | proto.WireBytes)
+		_ = b.EncodeStringBytes(x.SerializeError)
+	case *ConformanceResponse_RuntimeError:
+		_ = b.EncodeVarint(2<<3 | proto.WireBytes)
+		_ = b.EncodeStringBytes(x.RuntimeError)
+	case *ConformanceResponse_ProtobufPayload:
+		_ = b.EncodeVarint(3<<3 | proto.WireBytes)
+		_ = b.EncodeRawBytes(x.ProtobufPayload)
+	case *ConformanceResponse_JsonPayload:
+		_ = b.EncodeVarint(4<<3 | proto.WireBytes)
+		_ = b.EncodeStringBytes(x.JsonPayload)
+	case *ConformanceResponse_Skipped:
+		_ = b.EncodeVarint(5<<3 | proto.WireBytes)
+		_ = b.EncodeStringBytes(x.Skipped)
+	case nil:
+	default:
+		return fmt.Errorf("ConformanceResponse.Result has unexpected type %T", x)
+	}
+	return nil
+}
+
+func _ConformanceResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
+	m := msg.(*ConformanceResponse)
+	switch tag {
+	case 1: // result.parse_error
+		if wire != proto.WireBytes {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeStringBytes()
+		m.Result = &ConformanceResponse_ParseError{x}
+		return true, err
+	case 6: // result.serialize_error
+		if wire != proto.WireBytes {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeStringBytes()
+		m.Result = &ConformanceResponse_SerializeError{x}
+		return true, err
+	case 2: // result.runtime_error
+		if wire != proto.WireBytes {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeStringBytes()
+		m.Result = &ConformanceResponse_RuntimeError{x}
+		return true, err
+	case 3: // result.protobuf_payload
+		if wire != proto.WireBytes {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeRawBytes(true)
+		m.Result = &ConformanceResponse_ProtobufPayload{x}
+		return true, err
+	case 4: // result.json_payload
+		if wire != proto.WireBytes {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeStringBytes()
+		m.Result = &ConformanceResponse_JsonPayload{x}
+		return true, err
+	case 5: // result.skipped
+		if wire != proto.WireBytes {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeStringBytes()
+		m.Result = &ConformanceResponse_Skipped{x}
+		return true, err
+	default:
+		return false, nil
+	}
+}
+
+func _ConformanceResponse_OneofSizer(msg proto.Message) (n int) {
+	m := msg.(*ConformanceResponse)
+	// result
+	switch x := m.Result.(type) {
+	case *ConformanceResponse_ParseError:
+		n += proto.SizeVarint(1<<3 | proto.WireBytes)
+		n += proto.SizeVarint(uint64(len(x.ParseError)))
+		n += len(x.ParseError)
+	case *ConformanceResponse_SerializeError:
+		n += proto.SizeVarint(6<<3 | proto.WireBytes)
+		n += proto.SizeVarint(uint64(len(x.SerializeError)))
+		n += len(x.SerializeError)
+	case *ConformanceResponse_RuntimeError:
+		n += proto.SizeVarint(2<<3 | proto.WireBytes)
+		n += proto.SizeVarint(uint64(len(x.RuntimeError)))
+		n += len(x.RuntimeError)
+	case *ConformanceResponse_ProtobufPayload:
+		n += proto.SizeVarint(3<<3 | proto.WireBytes)
+		n += proto.SizeVarint(uint64(len(x.ProtobufPayload)))
+		n += len(x.ProtobufPayload)
+	case *ConformanceResponse_JsonPayload:
+		n += proto.SizeVarint(4<<3 | proto.WireBytes)
+		n += proto.SizeVarint(uint64(len(x.JsonPayload)))
+		n += len(x.JsonPayload)
+	case *ConformanceResponse_Skipped:
+		n += proto.SizeVarint(5<<3 | proto.WireBytes)
+		n += proto.SizeVarint(uint64(len(x.Skipped)))
+		n += len(x.Skipped)
+	case nil:
+	default:
+		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
+	}
+	return n
+}
+
+// This proto includes every type of field in both singular and repeated
+// forms.
+type TestAllTypes struct {
+	// Singular
+	OptionalInt32          int32                       `protobuf:"varint,1,opt,name=optional_int32,json=optionalInt32,proto3" json:"optional_int32,omitempty"`
+	OptionalInt64          int64                       `protobuf:"varint,2,opt,name=optional_int64,json=optionalInt64,proto3" json:"optional_int64,omitempty"`
+	OptionalUint32         uint32                      `protobuf:"varint,3,opt,name=optional_uint32,json=optionalUint32,proto3" json:"optional_uint32,omitempty"`
+	OptionalUint64         uint64                      `protobuf:"varint,4,opt,name=optional_uint64,json=optionalUint64,proto3" json:"optional_uint64,omitempty"`
+	OptionalSint32         int32                       `protobuf:"zigzag32,5,opt,name=optional_sint32,json=optionalSint32,proto3" json:"optional_sint32,omitempty"`
+	OptionalSint64         int64                       `protobuf:"zigzag64,6,opt,name=optional_sint64,json=optionalSint64,proto3" json:"optional_sint64,omitempty"`
+	OptionalFixed32        uint32                      `protobuf:"fixed32,7,opt,name=optional_fixed32,json=optionalFixed32,proto3" json:"optional_fixed32,omitempty"`
+	OptionalFixed64        uint64                      `protobuf:"fixed64,8,opt,name=optional_fixed64,json=optionalFixed64,proto3" json:"optional_fixed64,omitempty"`
+	OptionalSfixed32       int32                       `protobuf:"fixed32,9,opt,name=optional_sfixed32,json=optionalSfixed32,proto3" json:"optional_sfixed32,omitempty"`
+	OptionalSfixed64       int64                       `protobuf:"fixed64,10,opt,name=optional_sfixed64,json=optionalSfixed64,proto3" json:"optional_sfixed64,omitempty"`
+	OptionalFloat          float32                     `protobuf:"fixed32,11,opt,name=optional_float,json=optionalFloat,proto3" json:"optional_float,omitempty"`
+	OptionalDouble         float64                     `protobuf:"fixed64,12,opt,name=optional_double,json=optionalDouble,proto3" json:"optional_double,omitempty"`
+	OptionalBool           bool                        `protobuf:"varint,13,opt,name=optional_bool,json=optionalBool,proto3" json:"optional_bool,omitempty"`
+	OptionalString         string                      `protobuf:"bytes,14,opt,name=optional_string,json=optionalString,proto3" json:"optional_string,omitempty"`
+	OptionalBytes          []byte                      `protobuf:"bytes,15,opt,name=optional_bytes,json=optionalBytes,proto3" json:"optional_bytes,omitempty"`
+	OptionalNestedMessage  *TestAllTypes_NestedMessage `protobuf:"bytes,18,opt,name=optional_nested_message,json=optionalNestedMessage" json:"optional_nested_message,omitempty"`
+	OptionalForeignMessage *ForeignMessage             `protobuf:"bytes,19,opt,name=optional_foreign_message,json=optionalForeignMessage" json:"optional_foreign_message,omitempty"`
+	OptionalNestedEnum     TestAllTypes_NestedEnum     `protobuf:"varint,21,opt,name=optional_nested_enum,json=optionalNestedEnum,proto3,enum=conformance.TestAllTypes_NestedEnum" json:"optional_nested_enum,omitempty"`
+	OptionalForeignEnum    ForeignEnum                 `protobuf:"varint,22,opt,name=optional_foreign_enum,json=optionalForeignEnum,proto3,enum=conformance.ForeignEnum" json:"optional_foreign_enum,omitempty"`
+	OptionalStringPiece    string                      `protobuf:"bytes,24,opt,name=optional_string_piece,json=optionalStringPiece,proto3" json:"optional_string_piece,omitempty"`
+	OptionalCord           string                      `protobuf:"bytes,25,opt,name=optional_cord,json=optionalCord,proto3" json:"optional_cord,omitempty"`
+	RecursiveMessage       *TestAllTypes               `protobuf:"bytes,27,opt,name=recursive_message,json=recursiveMessage" json:"recursive_message,omitempty"`
+	// Repeated
+	RepeatedInt32          []int32                       `protobuf:"varint,31,rep,packed,name=repeated_int32,json=repeatedInt32" json:"repeated_int32,omitempty"`
+	RepeatedInt64          []int64                       `protobuf:"varint,32,rep,packed,name=repeated_int64,json=repeatedInt64" json:"repeated_int64,omitempty"`
+	RepeatedUint32         []uint32                      `protobuf:"varint,33,rep,packed,name=repeated_uint32,json=repeatedUint32" json:"repeated_uint32,omitempty"`
+	RepeatedUint64         []uint64                      `protobuf:"varint,34,rep,packed,name=repeated_uint64,json=repeatedUint64" json:"repeated_uint64,omitempty"`
+	RepeatedSint32         []int32                       `protobuf:"zigzag32,35,rep,packed,name=repeated_sint32,json=repeatedSint32" json:"repeated_sint32,omitempty"`
+	RepeatedSint64         []int64                       `protobuf:"zigzag64,36,rep,packed,name=repeated_sint64,json=repeatedSint64" json:"repeated_sint64,omitempty"`
+	RepeatedFixed32        []uint32                      `protobuf:"fixed32,37,rep,packed,name=repeated_fixed32,json=repeatedFixed32" json:"repeated_fixed32,omitempty"`
+	RepeatedFixed64        []uint64                      `protobuf:"fixed64,38,rep,packed,name=repeated_fixed64,json=repeatedFixed64" json:"repeated_fixed64,omitempty"`
+	RepeatedSfixed32       []int32                       `protobuf:"fixed32,39,rep,packed,name=repeated_sfixed32,json=repeatedSfixed32" json:"repeated_sfixed32,omitempty"`
+	RepeatedSfixed64       []int64                       `protobuf:"fixed64,40,rep,packed,name=repeated_sfixed64,json=repeatedSfixed64" json:"repeated_sfixed64,omitempty"`
+	RepeatedFloat          []float32                     `protobuf:"fixed32,41,rep,packed,name=repeated_float,json=repeatedFloat" json:"repeated_float,omitempty"`
+	RepeatedDouble         []float64                     `protobuf:"fixed64,42,rep,packed,name=repeated_double,json=repeatedDouble" json:"repeated_double,omitempty"`
+	RepeatedBool           []bool                        `protobuf:"varint,43,rep,packed,name=repeated_bool,json=repeatedBool" json:"repeated_bool,omitempty"`
+	RepeatedString         []string                      `protobuf:"bytes,44,rep,name=repeated_string,json=repeatedString" json:"repeated_string,omitempty"`
+	RepeatedBytes          [][]byte                      `protobuf:"bytes,45,rep,name=repeated_bytes,json=repeatedBytes" json:"repeated_bytes,omitempty"`
+	RepeatedNestedMessage  []*TestAllTypes_NestedMessage `protobuf:"bytes,48,rep,name=repeated_nested_message,json=repeatedNestedMessage" json:"repeated_nested_message,omitempty"`
+	RepeatedForeignMessage []*ForeignMessage             `protobuf:"bytes,49,rep,name=repeated_foreign_message,json=repeatedForeignMessage" json:"repeated_foreign_message,omitempty"`
+	RepeatedNestedEnum     []TestAllTypes_NestedEnum     `protobuf:"varint,51,rep,packed,name=repeated_nested_enum,json=repeatedNestedEnum,enum=conformance.TestAllTypes_NestedEnum" json:"repeated_nested_enum,omitempty"`
+	RepeatedForeignEnum    []ForeignEnum                 `protobuf:"varint,52,rep,packed,name=repeated_foreign_enum,json=repeatedForeignEnum,enum=conformance.ForeignEnum" json:"repeated_foreign_enum,omitempty"`
+	RepeatedStringPiece    []string                      `protobuf:"bytes,54,rep,name=repeated_string_piece,json=repeatedStringPiece" json:"repeated_string_piece,omitempty"`
+	RepeatedCord           []string                      `protobuf:"bytes,55,rep,name=repeated_cord,json=repeatedCord" json:"repeated_cord,omitempty"`
+	// Map
+	MapInt32Int32           map[int32]int32                        `protobuf:"bytes,56,rep,name=map_int32_int32,json=mapInt32Int32" json:"map_int32_int32,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
+	MapInt64Int64           map[int64]int64                        `protobuf:"bytes,57,rep,name=map_int64_int64,json=mapInt64Int64" json:"map_int64_int64,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
+	MapUint32Uint32         map[uint32]uint32                      `protobuf:"bytes,58,rep,name=map_uint32_uint32,json=mapUint32Uint32" json:"map_uint32_uint32,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
+	MapUint64Uint64         map[uint64]uint64                      `protobuf:"bytes,59,rep,name=map_uint64_uint64,json=mapUint64Uint64" json:"map_uint64_uint64,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
+	MapSint32Sint32         map[int32]int32                        `protobuf:"bytes,60,rep,name=map_sint32_sint32,json=mapSint32Sint32" json:"map_sint32_sint32,omitempty" protobuf_key:"zigzag32,1,opt,name=key,proto3" protobuf_val:"zigzag32,2,opt,name=value,proto3"`
+	MapSint64Sint64         map[int64]int64                        `protobuf:"bytes,61,rep,name=map_sint64_sint64,json=mapSint64Sint64" json:"map_sint64_sint64,omitempty" protobuf_key:"zigzag64,1,opt,name=key,proto3" protobuf_val:"zigzag64,2,opt,name=value,proto3"`
+	MapFixed32Fixed32       map[uint32]uint32                      `protobuf:"bytes,62,rep,name=map_fixed32_fixed32,json=mapFixed32Fixed32" json:"map_fixed32_fixed32,omitempty" protobuf_key:"fixed32,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"`
+	MapFixed64Fixed64       map[uint64]uint64                      `protobuf:"bytes,63,rep,name=map_fixed64_fixed64,json=mapFixed64Fixed64" json:"map_fixed64_fixed64,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"`
+	MapSfixed32Sfixed32     map[int32]int32                        `protobuf:"bytes,64,rep,name=map_sfixed32_sfixed32,json=mapSfixed32Sfixed32" json:"map_sfixed32_sfixed32,omitempty" protobuf_key:"fixed32,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"`
+	MapSfixed64Sfixed64     map[int64]int64                        `protobuf:"bytes,65,rep,name=map_sfixed64_sfixed64,json=mapSfixed64Sfixed64" json:"map_sfixed64_sfixed64,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"`
+	MapInt32Float           map[int32]float32                      `protobuf:"bytes,66,rep,name=map_int32_float,json=mapInt32Float" json:"map_int32_float,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"`
+	MapInt32Double          map[int32]float64                      `protobuf:"bytes,67,rep,name=map_int32_double,json=mapInt32Double" json:"map_int32_double,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"`
+	MapBoolBool             map[bool]bool                          `protobuf:"bytes,68,rep,name=map_bool_bool,json=mapBoolBool" json:"map_bool_bool,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
+	MapStringString         map[string]string                      `protobuf:"bytes,69,rep,name=map_string_string,json=mapStringString" json:"map_string_string,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+	MapStringBytes          map[string][]byte                      `protobuf:"bytes,70,rep,name=map_string_bytes,json=mapStringBytes" json:"map_string_bytes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+	MapStringNestedMessage  map[string]*TestAllTypes_NestedMessage `protobuf:"bytes,71,rep,name=map_string_nested_message,json=mapStringNestedMessage" json:"map_string_nested_message,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"`
+	MapStringForeignMessage map[string]*ForeignMessage             `protobuf:"bytes,72,rep,name=map_string_foreign_message,json=mapStringForeignMessage" json:"map_string_foreign_message,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"`
+	MapStringNestedEnum     map[string]TestAllTypes_NestedEnum     `protobuf:"bytes,73,rep,name=map_string_nested_enum,json=mapStringNestedEnum" json:"map_string_nested_enum,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=conformance.TestAllTypes_NestedEnum"`
+	MapStringForeignEnum    map[string]ForeignEnum                 `protobuf:"bytes,74,rep,name=map_string_foreign_enum,json=mapStringForeignEnum" json:"map_string_foreign_enum,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=conformance.ForeignEnum"`
+	// Types that are valid to be assigned to OneofField:
+	//	*TestAllTypes_OneofUint32
+	//	*TestAllTypes_OneofNestedMessage
+	//	*TestAllTypes_OneofString
+	//	*TestAllTypes_OneofBytes
+	//	*TestAllTypes_OneofBool
+	//	*TestAllTypes_OneofUint64
+	//	*TestAllTypes_OneofFloat
+	//	*TestAllTypes_OneofDouble
+	//	*TestAllTypes_OneofEnum
+	OneofField isTestAllTypes_OneofField `protobuf_oneof:"oneof_field"`
+	// Well-known types
+	OptionalBoolWrapper   *google_protobuf5.BoolValue     `protobuf:"bytes,201,opt,name=optional_bool_wrapper,json=optionalBoolWrapper" json:"optional_bool_wrapper,omitempty"`
+	OptionalInt32Wrapper  *google_protobuf5.Int32Value    `protobuf:"bytes,202,opt,name=optional_int32_wrapper,json=optionalInt32Wrapper" json:"optional_int32_wrapper,omitempty"`
+	OptionalInt64Wrapper  *google_protobuf5.Int64Value    `protobuf:"bytes,203,opt,name=optional_int64_wrapper,json=optionalInt64Wrapper" json:"optional_int64_wrapper,omitempty"`
+	OptionalUint32Wrapper *google_protobuf5.UInt32Value   `protobuf:"bytes,204,opt,name=optional_uint32_wrapper,json=optionalUint32Wrapper" json:"optional_uint32_wrapper,omitempty"`
+	OptionalUint64Wrapper *google_protobuf5.UInt64Value   `protobuf:"bytes,205,opt,name=optional_uint64_wrapper,json=optionalUint64Wrapper" json:"optional_uint64_wrapper,omitempty"`
+	OptionalFloatWrapper  *google_protobuf5.FloatValue    `protobuf:"bytes,206,opt,name=optional_float_wrapper,json=optionalFloatWrapper" json:"optional_float_wrapper,omitempty"`
+	OptionalDoubleWrapper *google_protobuf5.DoubleValue   `protobuf:"bytes,207,opt,name=optional_double_wrapper,json=optionalDoubleWrapper" json:"optional_double_wrapper,omitempty"`
+	OptionalStringWrapper *google_protobuf5.StringValue   `protobuf:"bytes,208,opt,name=optional_string_wrapper,json=optionalStringWrapper" json:"optional_string_wrapper,omitempty"`
+	OptionalBytesWrapper  *google_protobuf5.BytesValue    `protobuf:"bytes,209,opt,name=optional_bytes_wrapper,json=optionalBytesWrapper" json:"optional_bytes_wrapper,omitempty"`
+	RepeatedBoolWrapper   []*google_protobuf5.BoolValue   `protobuf:"bytes,211,rep,name=repeated_bool_wrapper,json=repeatedBoolWrapper" json:"repeated_bool_wrapper,omitempty"`
+	RepeatedInt32Wrapper  []*google_protobuf5.Int32Value  `protobuf:"bytes,212,rep,name=repeated_int32_wrapper,json=repeatedInt32Wrapper" json:"repeated_int32_wrapper,omitempty"`
+	RepeatedInt64Wrapper  []*google_protobuf5.Int64Value  `protobuf:"bytes,213,rep,name=repeated_int64_wrapper,json=repeatedInt64Wrapper" json:"repeated_int64_wrapper,omitempty"`
+	RepeatedUint32Wrapper []*google_protobuf5.UInt32Value `protobuf:"bytes,214,rep,name=repeated_uint32_wrapper,json=repeatedUint32Wrapper" json:"repeated_uint32_wrapper,omitempty"`
+	RepeatedUint64Wrapper []*google_protobuf5.UInt64Value `protobuf:"bytes,215,rep,name=repeated_uint64_wrapper,json=repeatedUint64Wrapper" json:"repeated_uint64_wrapper,omitempty"`
+	RepeatedFloatWrapper  []*google_protobuf5.FloatValue  `protobuf:"bytes,216,rep,name=repeated_float_wrapper,json=repeatedFloatWrapper" json:"repeated_float_wrapper,omitempty"`
+	RepeatedDoubleWrapper []*google_protobuf5.DoubleValue `protobuf:"bytes,217,rep,name=repeated_double_wrapper,json=repeatedDoubleWrapper" json:"repeated_double_wrapper,omitempty"`
+	RepeatedStringWrapper []*google_protobuf5.StringValue `protobuf:"bytes,218,rep,name=repeated_string_wrapper,json=repeatedStringWrapper" json:"repeated_string_wrapper,omitempty"`
+	RepeatedBytesWrapper  []*google_protobuf5.BytesValue  `protobuf:"bytes,219,rep,name=repeated_bytes_wrapper,json=repeatedBytesWrapper" json:"repeated_bytes_wrapper,omitempty"`
+	OptionalDuration      *google_protobuf1.Duration      `protobuf:"bytes,301,opt,name=optional_duration,json=optionalDuration" json:"optional_duration,omitempty"`
+	OptionalTimestamp     *google_protobuf4.Timestamp     `protobuf:"bytes,302,opt,name=optional_timestamp,json=optionalTimestamp" json:"optional_timestamp,omitempty"`
+	OptionalFieldMask     *google_protobuf2.FieldMask     `protobuf:"bytes,303,opt,name=optional_field_mask,json=optionalFieldMask" json:"optional_field_mask,omitempty"`
+	OptionalStruct        *google_protobuf3.Struct        `protobuf:"bytes,304,opt,name=optional_struct,json=optionalStruct" json:"optional_struct,omitempty"`
+	OptionalAny           *google_protobuf.Any            `protobuf:"bytes,305,opt,name=optional_any,json=optionalAny" json:"optional_any,omitempty"`
+	OptionalValue         *google_protobuf3.Value         `protobuf:"bytes,306,opt,name=optional_value,json=optionalValue" json:"optional_value,omitempty"`
+	RepeatedDuration      []*google_protobuf1.Duration    `protobuf:"bytes,311,rep,name=repeated_duration,json=repeatedDuration" json:"repeated_duration,omitempty"`
+	RepeatedTimestamp     []*google_protobuf4.Timestamp   `protobuf:"bytes,312,rep,name=repeated_timestamp,json=repeatedTimestamp" json:"repeated_timestamp,omitempty"`
+	RepeatedFieldmask     []*google_protobuf2.FieldMask   `protobuf:"bytes,313,rep,name=repeated_fieldmask,json=repeatedFieldmask" json:"repeated_fieldmask,omitempty"`
+	RepeatedStruct        []*google_protobuf3.Struct      `protobuf:"bytes,324,rep,name=repeated_struct,json=repeatedStruct" json:"repeated_struct,omitempty"`
+	RepeatedAny           []*google_protobuf.Any          `protobuf:"bytes,315,rep,name=repeated_any,json=repeatedAny" json:"repeated_any,omitempty"`
+	RepeatedValue         []*google_protobuf3.Value       `protobuf:"bytes,316,rep,name=repeated_value,json=repeatedValue" json:"repeated_value,omitempty"`
+	// Test field-name-to-JSON-name convention.
+	// (protobuf says names can be any valid C/C++ identifier.)
+	Fieldname1    int32 `protobuf:"varint,401,opt,name=fieldname1,proto3" json:"fieldname1,omitempty"`
+	FieldName2    int32 `protobuf:"varint,402,opt,name=field_name2,json=fieldName2,proto3" json:"field_name2,omitempty"`
+	XFieldName3   int32 `protobuf:"varint,403,opt,name=_field_name3,json=FieldName3,proto3" json:"_field_name3,omitempty"`
+	Field_Name4_  int32 `protobuf:"varint,404,opt,name=field__name4_,json=fieldName4,proto3" json:"field__name4_,omitempty"`
+	Field0Name5   int32 `protobuf:"varint,405,opt,name=field0name5,proto3" json:"field0name5,omitempty"`
+	Field_0Name6  int32 `protobuf:"varint,406,opt,name=field_0_name6,json=field0Name6,proto3" json:"field_0_name6,omitempty"`
+	FieldName7    int32 `protobuf:"varint,407,opt,name=fieldName7,proto3" json:"fieldName7,omitempty"`
+	FieldName8    int32 `protobuf:"varint,408,opt,name=FieldName8,proto3" json:"FieldName8,omitempty"`
+	Field_Name9   int32 `protobuf:"varint,409,opt,name=field_Name9,json=fieldName9,proto3" json:"field_Name9,omitempty"`
+	Field_Name10  int32 `protobuf:"varint,410,opt,name=Field_Name10,json=FieldName10,proto3" json:"Field_Name10,omitempty"`
+	FIELD_NAME11  int32 `protobuf:"varint,411,opt,name=FIELD_NAME11,json=FIELDNAME11,proto3" json:"FIELD_NAME11,omitempty"`
+	FIELDName12   int32 `protobuf:"varint,412,opt,name=FIELD_name12,json=FIELDName12,proto3" json:"FIELD_name12,omitempty"`
+	XFieldName13  int32 `protobuf:"varint,413,opt,name=__field_name13,json=FieldName13,proto3" json:"__field_name13,omitempty"`
+	X_FieldName14 int32 `protobuf:"varint,414,opt,name=__Field_name14,json=FieldName14,proto3" json:"__Field_name14,omitempty"`
+	Field_Name15  int32 `protobuf:"varint,415,opt,name=field__name15,json=fieldName15,proto3" json:"field__name15,omitempty"`
+	Field__Name16 int32 `protobuf:"varint,416,opt,name=field__Name16,json=fieldName16,proto3" json:"field__Name16,omitempty"`
+	FieldName17__ int32 `protobuf:"varint,417,opt,name=field_name17__,json=fieldName17,proto3" json:"field_name17__,omitempty"`
+	FieldName18__ int32 `protobuf:"varint,418,opt,name=Field_name18__,json=FieldName18,proto3" json:"Field_name18__,omitempty"`
+}
+
+func (m *TestAllTypes) Reset()                    { *m = TestAllTypes{} }
+func (m *TestAllTypes) String() string            { return proto.CompactTextString(m) }
+func (*TestAllTypes) ProtoMessage()               {}
+func (*TestAllTypes) Descriptor() ([]byte, []int) { return fileDescriptorConformance, []int{2} }
+
+type isTestAllTypes_OneofField interface {
+	isTestAllTypes_OneofField()
+}
+
+type TestAllTypes_OneofUint32 struct {
+	OneofUint32 uint32 `protobuf:"varint,111,opt,name=oneof_uint32,json=oneofUint32,proto3,oneof"`
+}
+type TestAllTypes_OneofNestedMessage struct {
+	OneofNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,oneof"`
+}
+type TestAllTypes_OneofString struct {
+	OneofString string `protobuf:"bytes,113,opt,name=oneof_string,json=oneofString,proto3,oneof"`
+}
+type TestAllTypes_OneofBytes struct {
+	OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,proto3,oneof"`
+}
+type TestAllTypes_OneofBool struct {
+	OneofBool bool `protobuf:"varint,115,opt,name=oneof_bool,json=oneofBool,proto3,oneof"`
+}
+type TestAllTypes_OneofUint64 struct {
+	OneofUint64 uint64 `protobuf:"varint,116,opt,name=oneof_uint64,json=oneofUint64,proto3,oneof"`
+}
+type TestAllTypes_OneofFloat struct {
+	OneofFloat float32 `protobuf:"fixed32,117,opt,name=oneof_float,json=oneofFloat,proto3,oneof"`
+}
+type TestAllTypes_OneofDouble struct {
+	OneofDouble float64 `protobuf:"fixed64,118,opt,name=oneof_double,json=oneofDouble,proto3,oneof"`
+}
+type TestAllTypes_OneofEnum struct {
+	OneofEnum TestAllTypes_NestedEnum `protobuf:"varint,119,opt,name=oneof_enum,json=oneofEnum,proto3,enum=conformance.TestAllTypes_NestedEnum,oneof"`
+}
+
+func (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField()        {}
+func (*TestAllTypes_OneofNestedMessage) isTestAllTypes_OneofField() {}
+func (*TestAllTypes_OneofString) isTestAllTypes_OneofField()        {}
+func (*TestAllTypes_OneofBytes) isTestAllTypes_OneofField()         {}
+func (*TestAllTypes_OneofBool) isTestAllTypes_OneofField()          {}
+func (*TestAllTypes_OneofUint64) isTestAllTypes_OneofField()        {}
+func (*TestAllTypes_OneofFloat) isTestAllTypes_OneofField()         {}
+func (*TestAllTypes_OneofDouble) isTestAllTypes_OneofField()        {}
+func (*TestAllTypes_OneofEnum) isTestAllTypes_OneofField()          {}
+
+func (m *TestAllTypes) GetOneofField() isTestAllTypes_OneofField {
+	if m != nil {
+		return m.OneofField
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalInt32() int32 {
+	if m != nil {
+		return m.OptionalInt32
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOptionalInt64() int64 {
+	if m != nil {
+		return m.OptionalInt64
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOptionalUint32() uint32 {
+	if m != nil {
+		return m.OptionalUint32
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOptionalUint64() uint64 {
+	if m != nil {
+		return m.OptionalUint64
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOptionalSint32() int32 {
+	if m != nil {
+		return m.OptionalSint32
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOptionalSint64() int64 {
+	if m != nil {
+		return m.OptionalSint64
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOptionalFixed32() uint32 {
+	if m != nil {
+		return m.OptionalFixed32
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOptionalFixed64() uint64 {
+	if m != nil {
+		return m.OptionalFixed64
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOptionalSfixed32() int32 {
+	if m != nil {
+		return m.OptionalSfixed32
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOptionalSfixed64() int64 {
+	if m != nil {
+		return m.OptionalSfixed64
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOptionalFloat() float32 {
+	if m != nil {
+		return m.OptionalFloat
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOptionalDouble() float64 {
+	if m != nil {
+		return m.OptionalDouble
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOptionalBool() bool {
+	if m != nil {
+		return m.OptionalBool
+	}
+	return false
+}
+
+func (m *TestAllTypes) GetOptionalString() string {
+	if m != nil {
+		return m.OptionalString
+	}
+	return ""
+}
+
+func (m *TestAllTypes) GetOptionalBytes() []byte {
+	if m != nil {
+		return m.OptionalBytes
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalNestedMessage() *TestAllTypes_NestedMessage {
+	if m != nil {
+		return m.OptionalNestedMessage
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalForeignMessage() *ForeignMessage {
+	if m != nil {
+		return m.OptionalForeignMessage
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalNestedEnum() TestAllTypes_NestedEnum {
+	if m != nil {
+		return m.OptionalNestedEnum
+	}
+	return TestAllTypes_FOO
+}
+
+func (m *TestAllTypes) GetOptionalForeignEnum() ForeignEnum {
+	if m != nil {
+		return m.OptionalForeignEnum
+	}
+	return ForeignEnum_FOREIGN_FOO
+}
+
+func (m *TestAllTypes) GetOptionalStringPiece() string {
+	if m != nil {
+		return m.OptionalStringPiece
+	}
+	return ""
+}
+
+func (m *TestAllTypes) GetOptionalCord() string {
+	if m != nil {
+		return m.OptionalCord
+	}
+	return ""
+}
+
+func (m *TestAllTypes) GetRecursiveMessage() *TestAllTypes {
+	if m != nil {
+		return m.RecursiveMessage
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedInt32() []int32 {
+	if m != nil {
+		return m.RepeatedInt32
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedInt64() []int64 {
+	if m != nil {
+		return m.RepeatedInt64
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedUint32() []uint32 {
+	if m != nil {
+		return m.RepeatedUint32
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedUint64() []uint64 {
+	if m != nil {
+		return m.RepeatedUint64
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedSint32() []int32 {
+	if m != nil {
+		return m.RepeatedSint32
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedSint64() []int64 {
+	if m != nil {
+		return m.RepeatedSint64
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedFixed32() []uint32 {
+	if m != nil {
+		return m.RepeatedFixed32
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedFixed64() []uint64 {
+	if m != nil {
+		return m.RepeatedFixed64
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedSfixed32() []int32 {
+	if m != nil {
+		return m.RepeatedSfixed32
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedSfixed64() []int64 {
+	if m != nil {
+		return m.RepeatedSfixed64
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedFloat() []float32 {
+	if m != nil {
+		return m.RepeatedFloat
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedDouble() []float64 {
+	if m != nil {
+		return m.RepeatedDouble
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedBool() []bool {
+	if m != nil {
+		return m.RepeatedBool
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedString() []string {
+	if m != nil {
+		return m.RepeatedString
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedBytes() [][]byte {
+	if m != nil {
+		return m.RepeatedBytes
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedNestedMessage() []*TestAllTypes_NestedMessage {
+	if m != nil {
+		return m.RepeatedNestedMessage
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedForeignMessage() []*ForeignMessage {
+	if m != nil {
+		return m.RepeatedForeignMessage
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedNestedEnum() []TestAllTypes_NestedEnum {
+	if m != nil {
+		return m.RepeatedNestedEnum
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedForeignEnum() []ForeignEnum {
+	if m != nil {
+		return m.RepeatedForeignEnum
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedStringPiece() []string {
+	if m != nil {
+		return m.RepeatedStringPiece
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedCord() []string {
+	if m != nil {
+		return m.RepeatedCord
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapInt32Int32() map[int32]int32 {
+	if m != nil {
+		return m.MapInt32Int32
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapInt64Int64() map[int64]int64 {
+	if m != nil {
+		return m.MapInt64Int64
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapUint32Uint32() map[uint32]uint32 {
+	if m != nil {
+		return m.MapUint32Uint32
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapUint64Uint64() map[uint64]uint64 {
+	if m != nil {
+		return m.MapUint64Uint64
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapSint32Sint32() map[int32]int32 {
+	if m != nil {
+		return m.MapSint32Sint32
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapSint64Sint64() map[int64]int64 {
+	if m != nil {
+		return m.MapSint64Sint64
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapFixed32Fixed32() map[uint32]uint32 {
+	if m != nil {
+		return m.MapFixed32Fixed32
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapFixed64Fixed64() map[uint64]uint64 {
+	if m != nil {
+		return m.MapFixed64Fixed64
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapSfixed32Sfixed32() map[int32]int32 {
+	if m != nil {
+		return m.MapSfixed32Sfixed32
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapSfixed64Sfixed64() map[int64]int64 {
+	if m != nil {
+		return m.MapSfixed64Sfixed64
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapInt32Float() map[int32]float32 {
+	if m != nil {
+		return m.MapInt32Float
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapInt32Double() map[int32]float64 {
+	if m != nil {
+		return m.MapInt32Double
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapBoolBool() map[bool]bool {
+	if m != nil {
+		return m.MapBoolBool
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapStringString() map[string]string {
+	if m != nil {
+		return m.MapStringString
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapStringBytes() map[string][]byte {
+	if m != nil {
+		return m.MapStringBytes
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapStringNestedMessage() map[string]*TestAllTypes_NestedMessage {
+	if m != nil {
+		return m.MapStringNestedMessage
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapStringForeignMessage() map[string]*ForeignMessage {
+	if m != nil {
+		return m.MapStringForeignMessage
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapStringNestedEnum() map[string]TestAllTypes_NestedEnum {
+	if m != nil {
+		return m.MapStringNestedEnum
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetMapStringForeignEnum() map[string]ForeignEnum {
+	if m != nil {
+		return m.MapStringForeignEnum
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOneofUint32() uint32 {
+	if x, ok := m.GetOneofField().(*TestAllTypes_OneofUint32); ok {
+		return x.OneofUint32
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOneofNestedMessage() *TestAllTypes_NestedMessage {
+	if x, ok := m.GetOneofField().(*TestAllTypes_OneofNestedMessage); ok {
+		return x.OneofNestedMessage
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOneofString() string {
+	if x, ok := m.GetOneofField().(*TestAllTypes_OneofString); ok {
+		return x.OneofString
+	}
+	return ""
+}
+
+func (m *TestAllTypes) GetOneofBytes() []byte {
+	if x, ok := m.GetOneofField().(*TestAllTypes_OneofBytes); ok {
+		return x.OneofBytes
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOneofBool() bool {
+	if x, ok := m.GetOneofField().(*TestAllTypes_OneofBool); ok {
+		return x.OneofBool
+	}
+	return false
+}
+
+func (m *TestAllTypes) GetOneofUint64() uint64 {
+	if x, ok := m.GetOneofField().(*TestAllTypes_OneofUint64); ok {
+		return x.OneofUint64
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOneofFloat() float32 {
+	if x, ok := m.GetOneofField().(*TestAllTypes_OneofFloat); ok {
+		return x.OneofFloat
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOneofDouble() float64 {
+	if x, ok := m.GetOneofField().(*TestAllTypes_OneofDouble); ok {
+		return x.OneofDouble
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetOneofEnum() TestAllTypes_NestedEnum {
+	if x, ok := m.GetOneofField().(*TestAllTypes_OneofEnum); ok {
+		return x.OneofEnum
+	}
+	return TestAllTypes_FOO
+}
+
+func (m *TestAllTypes) GetOptionalBoolWrapper() *google_protobuf5.BoolValue {
+	if m != nil {
+		return m.OptionalBoolWrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalInt32Wrapper() *google_protobuf5.Int32Value {
+	if m != nil {
+		return m.OptionalInt32Wrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalInt64Wrapper() *google_protobuf5.Int64Value {
+	if m != nil {
+		return m.OptionalInt64Wrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalUint32Wrapper() *google_protobuf5.UInt32Value {
+	if m != nil {
+		return m.OptionalUint32Wrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalUint64Wrapper() *google_protobuf5.UInt64Value {
+	if m != nil {
+		return m.OptionalUint64Wrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalFloatWrapper() *google_protobuf5.FloatValue {
+	if m != nil {
+		return m.OptionalFloatWrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalDoubleWrapper() *google_protobuf5.DoubleValue {
+	if m != nil {
+		return m.OptionalDoubleWrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalStringWrapper() *google_protobuf5.StringValue {
+	if m != nil {
+		return m.OptionalStringWrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalBytesWrapper() *google_protobuf5.BytesValue {
+	if m != nil {
+		return m.OptionalBytesWrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedBoolWrapper() []*google_protobuf5.BoolValue {
+	if m != nil {
+		return m.RepeatedBoolWrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedInt32Wrapper() []*google_protobuf5.Int32Value {
+	if m != nil {
+		return m.RepeatedInt32Wrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedInt64Wrapper() []*google_protobuf5.Int64Value {
+	if m != nil {
+		return m.RepeatedInt64Wrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedUint32Wrapper() []*google_protobuf5.UInt32Value {
+	if m != nil {
+		return m.RepeatedUint32Wrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedUint64Wrapper() []*google_protobuf5.UInt64Value {
+	if m != nil {
+		return m.RepeatedUint64Wrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedFloatWrapper() []*google_protobuf5.FloatValue {
+	if m != nil {
+		return m.RepeatedFloatWrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedDoubleWrapper() []*google_protobuf5.DoubleValue {
+	if m != nil {
+		return m.RepeatedDoubleWrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedStringWrapper() []*google_protobuf5.StringValue {
+	if m != nil {
+		return m.RepeatedStringWrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedBytesWrapper() []*google_protobuf5.BytesValue {
+	if m != nil {
+		return m.RepeatedBytesWrapper
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalDuration() *google_protobuf1.Duration {
+	if m != nil {
+		return m.OptionalDuration
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalTimestamp() *google_protobuf4.Timestamp {
+	if m != nil {
+		return m.OptionalTimestamp
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalFieldMask() *google_protobuf2.FieldMask {
+	if m != nil {
+		return m.OptionalFieldMask
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalStruct() *google_protobuf3.Struct {
+	if m != nil {
+		return m.OptionalStruct
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalAny() *google_protobuf.Any {
+	if m != nil {
+		return m.OptionalAny
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetOptionalValue() *google_protobuf3.Value {
+	if m != nil {
+		return m.OptionalValue
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedDuration() []*google_protobuf1.Duration {
+	if m != nil {
+		return m.RepeatedDuration
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedTimestamp() []*google_protobuf4.Timestamp {
+	if m != nil {
+		return m.RepeatedTimestamp
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedFieldmask() []*google_protobuf2.FieldMask {
+	if m != nil {
+		return m.RepeatedFieldmask
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedStruct() []*google_protobuf3.Struct {
+	if m != nil {
+		return m.RepeatedStruct
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedAny() []*google_protobuf.Any {
+	if m != nil {
+		return m.RepeatedAny
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetRepeatedValue() []*google_protobuf3.Value {
+	if m != nil {
+		return m.RepeatedValue
+	}
+	return nil
+}
+
+func (m *TestAllTypes) GetFieldname1() int32 {
+	if m != nil {
+		return m.Fieldname1
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetFieldName2() int32 {
+	if m != nil {
+		return m.FieldName2
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetXFieldName3() int32 {
+	if m != nil {
+		return m.XFieldName3
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetField_Name4_() int32 {
+	if m != nil {
+		return m.Field_Name4_
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetField0Name5() int32 {
+	if m != nil {
+		return m.Field0Name5
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetField_0Name6() int32 {
+	if m != nil {
+		return m.Field_0Name6
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetFieldName7() int32 {
+	if m != nil {
+		return m.FieldName7
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetFieldName8() int32 {
+	if m != nil {
+		return m.FieldName8
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetField_Name9() int32 {
+	if m != nil {
+		return m.Field_Name9
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetField_Name10() int32 {
+	if m != nil {
+		return m.Field_Name10
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetFIELD_NAME11() int32 {
+	if m != nil {
+		return m.FIELD_NAME11
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetFIELDName12() int32 {
+	if m != nil {
+		return m.FIELDName12
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetXFieldName13() int32 {
+	if m != nil {
+		return m.XFieldName13
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetX_FieldName14() int32 {
+	if m != nil {
+		return m.X_FieldName14
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetField_Name15() int32 {
+	if m != nil {
+		return m.Field_Name15
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetField__Name16() int32 {
+	if m != nil {
+		return m.Field__Name16
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetFieldName17__() int32 {
+	if m != nil {
+		return m.FieldName17__
+	}
+	return 0
+}
+
+func (m *TestAllTypes) GetFieldName18__() int32 {
+	if m != nil {
+		return m.FieldName18__
+	}
+	return 0
+}
+
+// XXX_OneofFuncs is for the internal use of the proto package.
+func (*TestAllTypes) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
+	return _TestAllTypes_OneofMarshaler, _TestAllTypes_OneofUnmarshaler, _TestAllTypes_OneofSizer, []interface{}{
+		(*TestAllTypes_OneofUint32)(nil),
+		(*TestAllTypes_OneofNestedMessage)(nil),
+		(*TestAllTypes_OneofString)(nil),
+		(*TestAllTypes_OneofBytes)(nil),
+		(*TestAllTypes_OneofBool)(nil),
+		(*TestAllTypes_OneofUint64)(nil),
+		(*TestAllTypes_OneofFloat)(nil),
+		(*TestAllTypes_OneofDouble)(nil),
+		(*TestAllTypes_OneofEnum)(nil),
+	}
+}
+
+func _TestAllTypes_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
+	m := msg.(*TestAllTypes)
+	// oneof_field
+	switch x := m.OneofField.(type) {
+	case *TestAllTypes_OneofUint32:
+		_ = b.EncodeVarint(111<<3 | proto.WireVarint)
+		_ = b.EncodeVarint(uint64(x.OneofUint32))
+	case *TestAllTypes_OneofNestedMessage:
+		_ = b.EncodeVarint(112<<3 | proto.WireBytes)
+		if err := b.EncodeMessage(x.OneofNestedMessage); err != nil {
+			return err
+		}
+	case *TestAllTypes_OneofString:
+		_ = b.EncodeVarint(113<<3 | proto.WireBytes)
+		_ = b.EncodeStringBytes(x.OneofString)
+	case *TestAllTypes_OneofBytes:
+		_ = b.EncodeVarint(114<<3 | proto.WireBytes)
+		_ = b.EncodeRawBytes(x.OneofBytes)
+	case *TestAllTypes_OneofBool:
+		t := uint64(0)
+		if x.OneofBool {
+			t = 1
+		}
+		_ = b.EncodeVarint(115<<3 | proto.WireVarint)
+		_ = b.EncodeVarint(t)
+	case *TestAllTypes_OneofUint64:
+		_ = b.EncodeVarint(116<<3 | proto.WireVarint)
+		_ = b.EncodeVarint(uint64(x.OneofUint64))
+	case *TestAllTypes_OneofFloat:
+		_ = b.EncodeVarint(117<<3 | proto.WireFixed32)
+		_ = b.EncodeFixed32(uint64(math.Float32bits(x.OneofFloat)))
+	case *TestAllTypes_OneofDouble:
+		_ = b.EncodeVarint(118<<3 | proto.WireFixed64)
+		_ = b.EncodeFixed64(math.Float64bits(x.OneofDouble))
+	case *TestAllTypes_OneofEnum:
+		_ = b.EncodeVarint(119<<3 | proto.WireVarint)
+		_ = b.EncodeVarint(uint64(x.OneofEnum))
+	case nil:
+	default:
+		return fmt.Errorf("TestAllTypes.OneofField has unexpected type %T", x)
+	}
+	return nil
+}
+
+func _TestAllTypes_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
+	m := msg.(*TestAllTypes)
+	switch tag {
+	case 111: // oneof_field.oneof_uint32
+		if wire != proto.WireVarint {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeVarint()
+		m.OneofField = &TestAllTypes_OneofUint32{uint32(x)}
+		return true, err
+	case 112: // oneof_field.oneof_nested_message
+		if wire != proto.WireBytes {
+			return true, proto.ErrInternalBadWireType
+		}
+		msg := new(TestAllTypes_NestedMessage)
+		err := b.DecodeMessage(msg)
+		m.OneofField = &TestAllTypes_OneofNestedMessage{msg}
+		return true, err
+	case 113: // oneof_field.oneof_string
+		if wire != proto.WireBytes {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeStringBytes()
+		m.OneofField = &TestAllTypes_OneofString{x}
+		return true, err
+	case 114: // oneof_field.oneof_bytes
+		if wire != proto.WireBytes {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeRawBytes(true)
+		m.OneofField = &TestAllTypes_OneofBytes{x}
+		return true, err
+	case 115: // oneof_field.oneof_bool
+		if wire != proto.WireVarint {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeVarint()
+		m.OneofField = &TestAllTypes_OneofBool{x != 0}
+		return true, err
+	case 116: // oneof_field.oneof_uint64
+		if wire != proto.WireVarint {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeVarint()
+		m.OneofField = &TestAllTypes_OneofUint64{x}
+		return true, err
+	case 117: // oneof_field.oneof_float
+		if wire != proto.WireFixed32 {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeFixed32()
+		m.OneofField = &TestAllTypes_OneofFloat{math.Float32frombits(uint32(x))}
+		return true, err
+	case 118: // oneof_field.oneof_double
+		if wire != proto.WireFixed64 {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeFixed64()
+		m.OneofField = &TestAllTypes_OneofDouble{math.Float64frombits(x)}
+		return true, err
+	case 119: // oneof_field.oneof_enum
+		if wire != proto.WireVarint {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeVarint()
+		m.OneofField = &TestAllTypes_OneofEnum{TestAllTypes_NestedEnum(x)}
+		return true, err
+	default:
+		return false, nil
+	}
+}
+
+func _TestAllTypes_OneofSizer(msg proto.Message) (n int) {
+	m := msg.(*TestAllTypes)
+	// oneof_field
+	switch x := m.OneofField.(type) {
+	case *TestAllTypes_OneofUint32:
+		n += proto.SizeVarint(111<<3 | proto.WireVarint)
+		n += proto.SizeVarint(uint64(x.OneofUint32))
+	case *TestAllTypes_OneofNestedMessage:
+		s := proto.Size(x.OneofNestedMessage)
+		n += proto.SizeVarint(112<<3 | proto.WireBytes)
+		n += proto.SizeVarint(uint64(s))
+		n += s
+	case *TestAllTypes_OneofString:
+		n += proto.SizeVarint(113<<3 | proto.WireBytes)
+		n += proto.SizeVarint(uint64(len(x.OneofString)))
+		n += len(x.OneofString)
+	case *TestAllTypes_OneofBytes:
+		n += proto.SizeVarint(114<<3 | proto.WireBytes)
+		n += proto.SizeVarint(uint64(len(x.OneofBytes)))
+		n += len(x.OneofBytes)
+	case *TestAllTypes_OneofBool:
+		n += proto.SizeVarint(115<<3 | proto.WireVarint)
+		n += 1
+	case *TestAllTypes_OneofUint64:
+		n += proto.SizeVarint(116<<3 | proto.WireVarint)
+		n += proto.SizeVarint(uint64(x.OneofUint64))
+	case *TestAllTypes_OneofFloat:
+		n += proto.SizeVarint(117<<3 | proto.WireFixed32)
+		n += 4
+	case *TestAllTypes_OneofDouble:
+		n += proto.SizeVarint(118<<3 | proto.WireFixed64)
+		n += 8
+	case *TestAllTypes_OneofEnum:
+		n += proto.SizeVarint(119<<3 | proto.WireVarint)
+		n += proto.SizeVarint(uint64(x.OneofEnum))
+	case nil:
+	default:
+		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
+	}
+	return n
+}
+
+type TestAllTypes_NestedMessage struct {
+	A           int32         `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"`
+	Corecursive *TestAllTypes `protobuf:"bytes,2,opt,name=corecursive" json:"corecursive,omitempty"`
+}
+
+func (m *TestAllTypes_NestedMessage) Reset()         { *m = TestAllTypes_NestedMessage{} }
+func (m *TestAllTypes_NestedMessage) String() string { return proto.CompactTextString(m) }
+func (*TestAllTypes_NestedMessage) ProtoMessage()    {}
+func (*TestAllTypes_NestedMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptorConformance, []int{2, 0}
+}
+
+func (m *TestAllTypes_NestedMessage) GetA() int32 {
+	if m != nil {
+		return m.A
+	}
+	return 0
+}
+
+func (m *TestAllTypes_NestedMessage) GetCorecursive() *TestAllTypes {
+	if m != nil {
+		return m.Corecursive
+	}
+	return nil
+}
+
+type ForeignMessage struct {
+	C int32 `protobuf:"varint,1,opt,name=c,proto3" json:"c,omitempty"`
+}
+
+func (m *ForeignMessage) Reset()                    { *m = ForeignMessage{} }
+func (m *ForeignMessage) String() string            { return proto.CompactTextString(m) }
+func (*ForeignMessage) ProtoMessage()               {}
+func (*ForeignMessage) Descriptor() ([]byte, []int) { return fileDescriptorConformance, []int{3} }
+
+func (m *ForeignMessage) GetC() int32 {
+	if m != nil {
+		return m.C
+	}
+	return 0
+}
+
+func init() {
+	proto.RegisterType((*ConformanceRequest)(nil), "conformance.ConformanceRequest")
+	proto.RegisterType((*ConformanceResponse)(nil), "conformance.ConformanceResponse")
+	proto.RegisterType((*TestAllTypes)(nil), "conformance.TestAllTypes")
+	proto.RegisterType((*TestAllTypes_NestedMessage)(nil), "conformance.TestAllTypes.NestedMessage")
+	proto.RegisterType((*ForeignMessage)(nil), "conformance.ForeignMessage")
+	proto.RegisterEnum("conformance.WireFormat", WireFormat_name, WireFormat_value)
+	proto.RegisterEnum("conformance.ForeignEnum", ForeignEnum_name, ForeignEnum_value)
+	proto.RegisterEnum("conformance.TestAllTypes_NestedEnum", TestAllTypes_NestedEnum_name, TestAllTypes_NestedEnum_value)
+}
+
+func init() { proto.RegisterFile("conformance_proto/conformance.proto", fileDescriptorConformance) }
+
+var fileDescriptorConformance = []byte{
+	// 2737 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x5a, 0xd9, 0x72, 0xdb, 0xc8,
+	0xd5, 0x16, 0x08, 0x59, 0x4b, 0x93, 0x92, 0xa8, 0xd6, 0xd6, 0x96, 0x5d, 0x63, 0x58, 0xb2, 0x7f,
+	0xd3, 0xf6, 0x8c, 0xac, 0x05, 0x86, 0x65, 0xcf, 0x3f, 0x8e, 0x45, 0x9b, 0xb4, 0xe4, 0x8c, 0x25,
+	0x17, 0x64, 0x8d, 0xab, 0x9c, 0x0b, 0x06, 0xa6, 0x20, 0x15, 0xc7, 0x24, 0xc1, 0x01, 0x48, 0x4f,
+	0x94, 0xcb, 0xbc, 0x41, 0xf6, 0x7d, 0xbd, 0xcf, 0x7a, 0x93, 0xa4, 0x92, 0xab, 0x54, 0x6e, 0xb2,
+	0x27, 0x95, 0x3d, 0x79, 0x85, 0xbc, 0x43, 0x52, 0xbd, 0xa2, 0xbb, 0x01, 0x50, 0xf4, 0x54, 0x0d,
+	0x25, 0x1e, 0x7c, 0xfd, 0x9d, 0xd3, 0xe7, 0x1c, 0x7c, 0x2d, 0x1c, 0x18, 0x2c, 0xd7, 0x83, 0xf6,
+	0x51, 0x10, 0xb6, 0xbc, 0x76, 0xdd, 0xaf, 0x75, 0xc2, 0xa0, 0x1b, 0xdc, 0x90, 0x2c, 0x2b, 0xc4,
+	0x02, 0xf3, 0x92, 0x69, 0xf1, 0xec, 0x71, 0x10, 0x1c, 0x37, 0xfd, 0x1b, 0xe4, 0xd2, 0x8b, 0xde,
+	0xd1, 0x0d, 0xaf, 0x7d, 0x42, 0x71, 0x8b, 0x6f, 0xe8, 0x97, 0x0e, 0x7b, 0xa1, 0xd7, 0x6d, 0x04,
+	0x6d, 0x76, 0xdd, 0xd2, 0xaf, 0x1f, 0x35, 0xfc, 0xe6, 0x61, 0xad, 0xe5, 0x45, 0x2f, 0x19, 0xe2,
+	0xbc, 0x8e, 0x88, 0xba, 0x61, 0xaf, 0xde, 0x65, 0x57, 0x2f, 0xe8, 0x57, 0xbb, 0x8d, 0x96, 0x1f,
+	0x75, 0xbd, 0x56, 0x27, 0x2b, 0x80, 0x0f, 0x43, 0xaf, 0xd3, 0xf1, 0xc3, 0x88, 0x5e, 0x5f, 0xfa,
+	0x85, 0x01, 0xe0, 0xfd, 0x78, 0x2f, 0xae, 0xff, 0x41, 0xcf, 0x8f, 0xba, 0xf0, 0x3a, 0x28, 0xf2,
+	0x15, 0xb5, 0x8e, 0x77, 0xd2, 0x0c, 0xbc, 0x43, 0x64, 0x58, 0x46, 0xa9, 0xb0, 0x3d, 0xe4, 0x4e,
+	0xf1, 0x2b, 0x4f, 0xe8, 0x05, 0xb8, 0x0c, 0x0a, 0xef, 0x47, 0x41, 0x5b, 0x00, 0x73, 0x96, 0x51,
+	0x1a, 0xdf, 0x1e, 0x72, 0xf3, 0xd8, 0xca, 0x41, 0x7b, 0x60, 0x21, 0xa4, 0xe4, 0xfe, 0x61, 0x2d,
+	0xe8, 0x75, 0x3b, 0xbd, 0x6e, 0x8d, 0x78, 0xed, 0x22, 0xd3, 0x32, 0x4a, 0x93, 0xeb, 0x0b, 0x2b,
+	0x72, 0x9a, 0x9f, 0x35, 0x42, 0xbf, 0x4a, 0x2e, 0xbb, 0x73, 0x62, 0xdd, 0x1e, 0x59, 0x46, 0xcd,
+	0xe5, 0x71, 0x30, 0xca, 0x1c, 0x2e, 0x7d, 0x2a, 0x07, 0x66, 0x94, 0x4d, 0x44, 0x9d, 0xa0, 0x1d,
+	0xf9, 0xf0, 0x22, 0xc8, 0x77, 0xbc, 0x30, 0xf2, 0x6b, 0x7e, 0x18, 0x06, 0x21, 0xd9, 0x00, 0x8e,
+	0x0b, 0x10, 0x63, 0x05, 0xdb, 0xe0, 0x55, 0x30, 0x15, 0xf9, 0x61, 0xc3, 0x6b, 0x36, 0x3e, 0xc9,
+	0x61, 0x23, 0x0c, 0x36, 0x29, 0x2e, 0x50, 0xe8, 0x65, 0x30, 0x11, 0xf6, 0xda, 0x38, 0xc1, 0x0c,
+	0xc8, 0xf7, 0x59, 0x60, 0x66, 0x0a, 0x4b, 0x4b, 0x9d, 0x39, 0x68, 0xea, 0x86, 0xd3, 0x52, 0xb7,
+	0x08, 0x46, 0xa3, 0x97, 0x8d, 0x4e, 0xc7, 0x3f, 0x44, 0x67, 0xd8, 0x75, 0x6e, 0x28, 0x8f, 0x81,
+	0x91, 0xd0, 0x8f, 0x7a, 0xcd, 0xee, 0xd2, 0x7f, 0xaa, 0xa0, 0xf0, 0xd4, 0x8f, 0xba, 0x5b, 0xcd,
+	0xe6, 0xd3, 0x93, 0x8e, 0x1f, 0xc1, 0xcb, 0x60, 0x32, 0xe8, 0xe0, 0x5e, 0xf3, 0x9a, 0xb5, 0x46,
+	0xbb, 0xbb, 0xb1, 0x4e, 0x12, 0x70, 0xc6, 0x9d, 0xe0, 0xd6, 0x1d, 0x6c, 0xd4, 0x61, 0x8e, 0x4d,
+	0xf6, 0x65, 0x2a, 0x30, 0xc7, 0x86, 0x57, 0xc0, 0x94, 0x80, 0xf5, 0x28, 0x1d, 0xde, 0xd5, 0x84,
+	0x2b, 0x56, 0x1f, 0x10, 0x6b, 0x02, 0xe8, 0xd8, 0x64, 0x57, 0xc3, 0x2a, 0x50, 0x63, 0x8c, 0x28,
+	0x23, 0xde, 0xde, 0x74, 0x0c, 0xdc, 0x4f, 0x32, 0x46, 0x94, 0x11, 0xd7, 0x08, 0xaa, 0x40, 0xc7,
+	0x86, 0x57, 0x41, 0x51, 0x00, 0x8f, 0x1a, 0x9f, 0xf0, 0x0f, 0x37, 0xd6, 0xd1, 0xa8, 0x65, 0x94,
+	0x46, 0x5d, 0x41, 0x50, 0xa5, 0xe6, 0x24, 0xd4, 0xb1, 0xd1, 0x98, 0x65, 0x94, 0x46, 0x34, 0xa8,
+	0x63, 0xc3, 0xeb, 0x60, 0x3a, 0x76, 0xcf, 0x69, 0xc7, 0x2d, 0xa3, 0x34, 0xe5, 0x0a, 0x8e, 0x7d,
+	0x66, 0x4f, 0x01, 0x3b, 0x36, 0x02, 0x96, 0x51, 0x2a, 0xea, 0x60, 0xc7, 0x56, 0x52, 0x7f, 0xd4,
+	0x0c, 0xbc, 0x2e, 0xca, 0x5b, 0x46, 0x29, 0x17, 0xa7, 0xbe, 0x8a, 0x8d, 0xca, 0xfe, 0x0f, 0x83,
+	0xde, 0x8b, 0xa6, 0x8f, 0x0a, 0x96, 0x51, 0x32, 0xe2, 0xfd, 0x3f, 0x20, 0x56, 0xb8, 0x0c, 0xc4,
+	0xca, 0xda, 0x8b, 0x20, 0x68, 0xa2, 0x09, 0xcb, 0x28, 0x8d, 0xb9, 0x05, 0x6e, 0x2c, 0x07, 0x41,
+	0x53, 0xcd, 0x66, 0x37, 0x6c, 0xb4, 0x8f, 0xd1, 0x24, 0xee, 0x2a, 0x29, 0x9b, 0xc4, 0xaa, 0x44,
+	0xf7, 0xe2, 0xa4, 0xeb, 0x47, 0x68, 0x0a, 0xb7, 0x71, 0x1c, 0x5d, 0x19, 0x1b, 0x61, 0x0d, 0x2c,
+	0x08, 0x58, 0x9b, 0xde, 0xde, 0x2d, 0x3f, 0x8a, 0xbc, 0x63, 0x1f, 0x41, 0xcb, 0x28, 0xe5, 0xd7,
+	0xaf, 0x28, 0x37, 0xb6, 0xdc, 0xa2, 0x2b, 0xbb, 0x04, 0xff, 0x98, 0xc2, 0xdd, 0x39, 0xce, 0xa3,
+	0x98, 0xe1, 0x01, 0x40, 0x71, 0x96, 0x82, 0xd0, 0x6f, 0x1c, 0xb7, 0x85, 0x87, 0x19, 0xe2, 0xe1,
+	0x9c, 0xe2, 0xa1, 0x4a, 0x31, 0x9c, 0x75, 0x5e, 0x24, 0x53, 0xb1, 0xc3, 0xf7, 0xc0, 0xac, 0x1e,
+	0xb7, 0xdf, 0xee, 0xb5, 0xd0, 0x1c, 0x51, 0xa3, 0x4b, 0xa7, 0x05, 0x5d, 0x69, 0xf7, 0x5a, 0x2e,
+	0x54, 0x23, 0xc6, 0x36, 0xf8, 0x2e, 0x98, 0x4b, 0x84, 0x4b, 0x88, 0xe7, 0x09, 0x31, 0x4a, 0x8b,
+	0x95, 0x90, 0xcd, 0x68, 0x81, 0x12, 0x36, 0x47, 0x62, 0xa3, 0xd5, 0xaa, 0x75, 0x1a, 0x7e, 0xdd,
+	0x47, 0x08, 0xd7, 0xac, 0x9c, 0x1b, 0xcb, 0xc5, 0xeb, 0x68, 0xdd, 0x9e, 0xe0, 0xcb, 0xf0, 0x8a,
+	0xd4, 0x0a, 0xf5, 0x20, 0x3c, 0x44, 0x67, 0x19, 0xde, 0x88, 0xdb, 0xe1, 0x7e, 0x10, 0x1e, 0xc2,
+	0x2a, 0x98, 0x0e, 0xfd, 0x7a, 0x2f, 0x8c, 0x1a, 0xaf, 0x7c, 0x91, 0xd6, 0x73, 0x24, 0xad, 0x67,
+	0x33, 0x73, 0xe0, 0x16, 0xc5, 0x1a, 0x9e, 0xce, 0xcb, 0x60, 0x32, 0xf4, 0x3b, 0xbe, 0x87, 0xf3,
+	0x48, 0x6f, 0xe6, 0x0b, 0x96, 0x89, 0xd5, 0x86, 0x5b, 0x85, 0xda, 0xc8, 0x30, 0xc7, 0x46, 0x96,
+	0x65, 0x62, 0xb5, 0x91, 0x60, 0x54, 0x1b, 0x04, 0x8c, 0xa9, 0xcd, 0x45, 0xcb, 0xc4, 0x6a, 0xc3,
+	0xcd, 0xb1, 0xda, 0x28, 0x40, 0xc7, 0x46, 0x4b, 0x96, 0x89, 0xd5, 0x46, 0x06, 0x6a, 0x8c, 0x4c,
+	0x6d, 0x96, 0x2d, 0x13, 0xab, 0x0d, 0x37, 0xef, 0x27, 0x19, 0x99, 0xda, 0x5c, 0xb2, 0x4c, 0xac,
+	0x36, 0x32, 0x90, 0xaa, 0x8d, 0x00, 0x72, 0x59, 0xb8, 0x6c, 0x99, 0x58, 0x6d, 0xb8, 0x5d, 0x52,
+	0x1b, 0x15, 0xea, 0xd8, 0xe8, 0xff, 0x2c, 0x13, 0xab, 0x8d, 0x02, 0xa5, 0x6a, 0x13, 0xbb, 0xe7,
+	0xb4, 0x57, 0x2c, 0x13, 0xab, 0x8d, 0x08, 0x40, 0x52, 0x1b, 0x0d, 0xec, 0xd8, 0xa8, 0x64, 0x99,
+	0x58, 0x6d, 0x54, 0x30, 0x55, 0x9b, 0x38, 0x08, 0xa2, 0x36, 0x57, 0x2d, 0x13, 0xab, 0x8d, 0x08,
+	0x81, 0xab, 0x8d, 0x80, 0x31, 0xb5, 0xb9, 0x66, 0x99, 0x58, 0x6d, 0xb8, 0x39, 0x56, 0x1b, 0x01,
+	0x24, 0x6a, 0x73, 0xdd, 0x32, 0xb1, 0xda, 0x70, 0x23, 0x57, 0x9b, 0x38, 0x42, 0xaa, 0x36, 0x6f,
+	0x5a, 0x26, 0x56, 0x1b, 0x11, 0x9f, 0x50, 0x9b, 0x98, 0x8d, 0xa8, 0xcd, 0x5b, 0x96, 0x89, 0xd5,
+	0x46, 0xd0, 0x71, 0xb5, 0x11, 0x30, 0x4d, 0x6d, 0x56, 0x2d, 0xf3, 0xb5, 0xd4, 0x86, 0xf3, 0x24,
+	0xd4, 0x26, 0xce, 0x92, 0xa6, 0x36, 0x6b, 0xc4, 0x43, 0x7f, 0xb5, 0x11, 0xc9, 0x4c, 0xa8, 0x8d,
+	0x1e, 0x37, 0x11, 0x85, 0x0d, 0xcb, 0x1c, 0x5c, 0x6d, 0xd4, 0x88, 0xb9, 0xda, 0x24, 0xc2, 0x25,
+	0xc4, 0x36, 0x21, 0xee, 0xa3, 0x36, 0x5a, 0xa0, 0x5c, 0x6d, 0xb4, 0x6a, 0x31, 0xb5, 0x71, 0x70,
+	0xcd, 0xa8, 0xda, 0xa8, 0x75, 0x13, 0x6a, 0x23, 0xd6, 0x11, 0xb5, 0xb9, 0xc5, 0xf0, 0x46, 0xdc,
+	0x0e, 0x44, 0x6d, 0x9e, 0x82, 0xa9, 0x96, 0xd7, 0xa1, 0x02, 0xc1, 0x64, 0x62, 0x93, 0x24, 0xf5,
+	0xcd, 0xec, 0x0c, 0x3c, 0xf6, 0x3a, 0x44, 0x3b, 0xc8, 0x47, 0xa5, 0xdd, 0x0d, 0x4f, 0xdc, 0x89,
+	0x96, 0x6c, 0x93, 0x58, 0x1d, 0x9b, 0xa9, 0xca, 0xed, 0xc1, 0x58, 0x1d, 0x9b, 0x7c, 0x28, 0xac,
+	0xcc, 0x06, 0x9f, 0x83, 0x69, 0xcc, 0x4a, 0xe5, 0x87, 0xab, 0xd0, 0x1d, 0xc2, 0xbb, 0xd2, 0x97,
+	0x97, 0x4a, 0x13, 0xfd, 0xa4, 0xcc, 0x38, 0x3c, 0xd9, 0x2a, 0x73, 0x3b, 0x36, 0x17, 0xae, 0xb7,
+	0x07, 0xe4, 0x76, 0x6c, 0xfa, 0xa9, 0x72, 0x73, 0x2b, 0xe7, 0xa6, 0x22, 0xc7, 0xb5, 0xee, 0xff,
+	0x07, 0xe0, 0xa6, 0x02, 0xb8, 0xaf, 0xc5, 0x2d, 0x5b, 0x65, 0x6e, 0xc7, 0xe6, 0xf2, 0xf8, 0xce,
+	0x80, 0xdc, 0x8e, 0xbd, 0xaf, 0xc5, 0x2d, 0x5b, 0xe1, 0xc7, 0xc1, 0x0c, 0xe6, 0x66, 0xda, 0x26,
+	0x24, 0xf5, 0x2e, 0x61, 0x5f, 0xed, 0xcb, 0xce, 0x74, 0x96, 0xfd, 0xa0, 0xfc, 0x38, 0x50, 0xd5,
+	0xae, 0x78, 0x70, 0x6c, 0xa1, 0xc4, 0x1f, 0x19, 0xd4, 0x83, 0x63, 0xb3, 0x1f, 0x9a, 0x07, 0x61,
+	0x87, 0x47, 0x60, 0x8e, 0xe4, 0x87, 0x6f, 0x42, 0x28, 0xf8, 0x3d, 0xe2, 0x63, 0xbd, 0x7f, 0x8e,
+	0x18, 0x98, 0xff, 0xa4, 0x5e, 0x70, 0xc8, 0xfa, 0x15, 0xd5, 0x0f, 0xae, 0x04, 0xdf, 0xcb, 0xd6,
+	0xc0, 0x7e, 0x1c, 0x9b, 0xff, 0xd4, 0xfd, 0xc4, 0x57, 0xd4, 0xfb, 0x95, 0x1e, 0x1a, 0xe5, 0x41,
+	0xef, 0x57, 0x72, 0x9c, 0x68, 0xf7, 0x2b, 0x3d, 0x62, 0x9e, 0x81, 0x62, 0xcc, 0xca, 0xce, 0x98,
+	0xfb, 0x84, 0xf6, 0xad, 0xd3, 0x69, 0xe9, 0xe9, 0x43, 0x79, 0x27, 0x5b, 0x8a, 0x11, 0xee, 0x02,
+	0xec, 0x89, 0x9c, 0x46, 0xf4, 0x48, 0x7a, 0x40, 0x58, 0xaf, 0xf5, 0x65, 0xc5, 0xe7, 0x14, 0xfe,
+	0x9f, 0x52, 0xe6, 0x5b, 0xb1, 0x45, 0xb4, 0x3b, 0x95, 0x42, 0x76, 0x7e, 0x55, 0x06, 0x69, 0x77,
+	0x02, 0xa5, 0x9f, 0x52, 0xbb, 0x4b, 0x56, 0x9e, 0x04, 0xc6, 0x4d, 0x8f, 0xbc, 0xea, 0x00, 0x49,
+	0xa0, 0xcb, 0xc9, 0x69, 0x18, 0x27, 0x41, 0x32, 0xc2, 0x0e, 0x38, 0x2b, 0x11, 0x6b, 0x87, 0xe4,
+	0x43, 0xe2, 0xe1, 0xe6, 0x00, 0x1e, 0x94, 0x63, 0x91, 0x7a, 0x9a, 0x6f, 0xa5, 0x5e, 0x84, 0x11,
+	0x58, 0x94, 0x3c, 0xea, 0xa7, 0xe6, 0x36, 0x71, 0xe9, 0x0c, 0xe0, 0x52, 0x3d, 0x33, 0xa9, 0xcf,
+	0x85, 0x56, 0xfa, 0x55, 0x78, 0x0c, 0xe6, 0x93, 0xdb, 0x24, 0x47, 0xdf, 0xce, 0x20, 0xf7, 0x80,
+	0xb4, 0x0d, 0x7c, 0xf4, 0x49, 0xf7, 0x80, 0x76, 0x05, 0xbe, 0x0f, 0x16, 0x52, 0x76, 0x47, 0x3c,
+	0x3d, 0x22, 0x9e, 0x36, 0x06, 0xdf, 0x5a, 0xec, 0x6a, 0xb6, 0x95, 0x72, 0x09, 0x2e, 0x83, 0x42,
+	0xd0, 0xf6, 0x83, 0x23, 0x7e, 0xdc, 0x04, 0xf8, 0x11, 0x7b, 0x7b, 0xc8, 0xcd, 0x13, 0x2b, 0x3b,
+	0x3c, 0x3e, 0x06, 0x66, 0x29, 0x48, 0xab, 0x6d, 0xe7, 0xb5, 0x1e, 0xb7, 0xb6, 0x87, 0x5c, 0x48,
+	0x68, 0xd4, 0x5a, 0x8a, 0x08, 0x58, 0xb7, 0x7f, 0xc0, 0x27, 0x12, 0xc4, 0xca, 0x7a, 0xf7, 0x22,
+	0xa0, 0x5f, 0x59, 0xdb, 0x86, 0x6c, 0xbc, 0x01, 0x88, 0x91, 0x76, 0xe1, 0x05, 0x00, 0x18, 0x04,
+	0xdf, 0x87, 0x11, 0x7e, 0x10, 0xdd, 0x1e, 0x72, 0xc7, 0x29, 0x02, 0xdf, 0x5b, 0xca, 0x56, 0x1d,
+	0x1b, 0x75, 0x2d, 0xa3, 0x34, 0xac, 0x6c, 0xd5, 0xb1, 0x63, 0x47, 0x54, 0x7b, 0x7a, 0xf8, 0xf1,
+	0x58, 0x38, 0xa2, 0x62, 0x22, 0x78, 0x98, 0x90, 0xbc, 0xc2, 0x8f, 0xc6, 0x82, 0x87, 0x09, 0x43,
+	0x85, 0x47, 0x43, 0xca, 0xf6, 0xe1, 0xe0, 0x8f, 0x78, 0x22, 0x66, 0x52, 0x9e, 0x3d, 0xe9, 0x69,
+	0x8c, 0x88, 0x0c, 0x9b, 0xa6, 0xa1, 0x5f, 0x19, 0x24, 0xf7, 0x8b, 0x2b, 0x74, 0xdc, 0xb6, 0xc2,
+	0xe7, 0x3c, 0x2b, 0x78, 0xab, 0xef, 0x79, 0xcd, 0x9e, 0x1f, 0x3f, 0xa6, 0x61, 0xd3, 0x33, 0xba,
+	0x0e, 0xba, 0x60, 0x5e, 0x9d, 0xd1, 0x08, 0xc6, 0x5f, 0x1b, 0xec, 0xd1, 0x56, 0x67, 0x24, 0x7a,
+	0x47, 0x29, 0x67, 0x95, 0x49, 0x4e, 0x06, 0xa7, 0x63, 0x0b, 0xce, 0xdf, 0xf4, 0xe1, 0x74, 0xec,
+	0x24, 0xa7, 0x63, 0x73, 0xce, 0x03, 0xe9, 0x21, 0xbf, 0xa7, 0x06, 0xfa, 0x5b, 0x4a, 0x7a, 0x3e,
+	0x41, 0x7a, 0x20, 0x45, 0x3a, 0xa7, 0x0e, 0x89, 0xb2, 0x68, 0xa5, 0x58, 0x7f, 0xd7, 0x8f, 0x96,
+	0x07, 0x3b, 0xa7, 0x8e, 0x94, 0xd2, 0x32, 0x40, 0x1a, 0x47, 0xb0, 0xfe, 0x3e, 0x2b, 0x03, 0xa4,
+	0x97, 0xb4, 0x0c, 0x10, 0x5b, 0x5a, 0xa8, 0xb4, 0xd3, 0x04, 0xe9, 0x1f, 0xb2, 0x42, 0xa5, 0xcd,
+	0xa7, 0x85, 0x4a, 0x8d, 0x69, 0xb4, 0x4c, 0x61, 0x38, 0xed, 0x1f, 0xb3, 0x68, 0xe9, 0x4d, 0xa8,
+	0xd1, 0x52, 0x63, 0x5a, 0x06, 0xc8, 0x3d, 0x2a, 0x58, 0xff, 0x94, 0x95, 0x01, 0x72, 0xdb, 0x6a,
+	0x19, 0x20, 0x36, 0xce, 0xb9, 0x27, 0x3d, 0x1c, 0x28, 0xcd, 0xff, 0x67, 0x83, 0xc8, 0x60, 0xdf,
+	0xe6, 0x97, 0x1f, 0x0a, 0xa5, 0x20, 0xd5, 0x91, 0x81, 0x60, 0xfc, 0x8b, 0xc1, 0x9e, 0xb4, 0xfa,
+	0x35, 0xbf, 0x32, 0x58, 0xc8, 0xe0, 0x94, 0x1a, 0xea, 0xaf, 0x7d, 0x38, 0x45, 0xf3, 0x2b, 0x53,
+	0x08, 0xa9, 0x46, 0xda, 0x30, 0x42, 0x90, 0xfe, 0x8d, 0x92, 0x9e, 0xd2, 0xfc, 0xea, 0xcc, 0x22,
+	0x8b, 0x56, 0x8a, 0xf5, 0xef, 0xfd, 0x68, 0x45, 0xf3, 0xab, 0x13, 0x8e, 0xb4, 0x0c, 0xa8, 0xcd,
+	0xff, 0x8f, 0xac, 0x0c, 0xc8, 0xcd, 0xaf, 0x0c, 0x03, 0xd2, 0x42, 0xd5, 0x9a, 0xff, 0x9f, 0x59,
+	0xa1, 0x2a, 0xcd, 0xaf, 0x8e, 0x0e, 0xd2, 0x68, 0xb5, 0xe6, 0xff, 0x57, 0x16, 0xad, 0xd2, 0xfc,
+	0xea, 0xb3, 0x68, 0x5a, 0x06, 0xd4, 0xe6, 0xff, 0x77, 0x56, 0x06, 0xe4, 0xe6, 0x57, 0x06, 0x0e,
+	0x9c, 0xf3, 0xa1, 0x34, 0xd7, 0xe5, 0xef, 0x70, 0xd0, 0x77, 0x73, 0x6c, 0x4e, 0x96, 0xd8, 0x3b,
+	0x43, 0xc4, 0x33, 0x5f, 0x6e, 0x81, 0x8f, 0x80, 0x18, 0x1a, 0xd6, 0xc4, 0xcb, 0x1a, 0xf4, 0xbd,
+	0x5c, 0xc6, 0xf9, 0xf1, 0x94, 0x43, 0x5c, 0xe1, 0x5f, 0x98, 0xe0, 0x47, 0xc1, 0x8c, 0x34, 0xc4,
+	0xe6, 0x2f, 0x8e, 0xd0, 0xf7, 0xb3, 0xc8, 0xaa, 0x18, 0xf3, 0xd8, 0x8b, 0x5e, 0xc6, 0x64, 0xc2,
+	0x04, 0xb7, 0xd4, 0xb9, 0x70, 0xaf, 0xde, 0x45, 0x3f, 0xa0, 0x44, 0x0b, 0x69, 0x45, 0xe8, 0xd5,
+	0xbb, 0xca, 0xc4, 0xb8, 0x57, 0xef, 0xc2, 0x4d, 0x20, 0x66, 0x8b, 0x35, 0xaf, 0x7d, 0x82, 0x7e,
+	0x48, 0xd7, 0xcf, 0x26, 0xd6, 0x6f, 0xb5, 0x4f, 0xdc, 0x3c, 0x87, 0x6e, 0xb5, 0x4f, 0xe0, 0x5d,
+	0x69, 0xd6, 0xfc, 0x0a, 0x97, 0x01, 0xfd, 0x88, 0xae, 0x9d, 0x4f, 0xac, 0xa5, 0x55, 0x12, 0xd3,
+	0x4d, 0xf2, 0x15, 0x97, 0x27, 0x6e, 0x50, 0x5e, 0x9e, 0x1f, 0xe7, 0x48, 0xb5, 0xfb, 0x95, 0x47,
+	0xf4, 0xa5, 0x54, 0x1e, 0x41, 0x14, 0x97, 0xe7, 0x27, 0xb9, 0x0c, 0x85, 0x93, 0xca, 0xc3, 0x97,
+	0xc5, 0xe5, 0x91, 0xb9, 0x48, 0x79, 0x48, 0x75, 0x7e, 0x9a, 0xc5, 0x25, 0x55, 0x27, 0x1e, 0x0a,
+	0xb2, 0x55, 0xb8, 0x3a, 0xf2, 0xad, 0x82, 0xab, 0xf3, 0x4b, 0x4a, 0x94, 0x5d, 0x1d, 0xe9, 0xee,
+	0x60, 0xd5, 0x11, 0x14, 0xb8, 0x3a, 0x3f, 0xa3, 0xeb, 0x33, 0xaa, 0xc3, 0xa1, 0xac, 0x3a, 0x62,
+	0x25, 0xad, 0xce, 0xcf, 0xe9, 0xda, 0xcc, 0xea, 0x70, 0x38, 0xad, 0xce, 0x05, 0x00, 0xc8, 0xfe,
+	0xdb, 0x5e, 0xcb, 0x5f, 0x43, 0x9f, 0x36, 0xc9, 0x6b, 0x28, 0xc9, 0x04, 0x2d, 0x90, 0xa7, 0xfd,
+	0x8b, 0xbf, 0xae, 0xa3, 0xcf, 0xc8, 0x88, 0x5d, 0x6c, 0x82, 0x17, 0x41, 0xa1, 0x16, 0x43, 0x36,
+	0xd0, 0x67, 0x19, 0xa4, 0xca, 0x21, 0x1b, 0x70, 0x09, 0x4c, 0x50, 0x04, 0x81, 0xd8, 0x35, 0xf4,
+	0x39, 0x9d, 0x86, 0xfc, 0x3d, 0x49, 0xbe, 0xad, 0x62, 0xc8, 0x4d, 0xf4, 0x79, 0x8a, 0x90, 0x6d,
+	0x70, 0x99, 0xd3, 0xac, 0x12, 0x1e, 0x07, 0x7d, 0x41, 0x01, 0x61, 0x1e, 0x47, 0xec, 0x08, 0x7f,
+	0xbb, 0x85, 0xbe, 0xa8, 0x3b, 0xba, 0x85, 0x01, 0x22, 0xb4, 0x4d, 0xf4, 0x25, 0x3d, 0xda, 0xcd,
+	0x78, 0xcb, 0xf8, 0xeb, 0x6d, 0xf4, 0x65, 0x9d, 0xe2, 0x36, 0x5c, 0x02, 0x85, 0xaa, 0x40, 0xac,
+	0xad, 0xa2, 0xaf, 0xb0, 0x38, 0x04, 0xc9, 0xda, 0x2a, 0xc1, 0xec, 0x54, 0xde, 0x7d, 0x50, 0xdb,
+	0xdd, 0x7a, 0x5c, 0x59, 0x5b, 0x43, 0x5f, 0xe5, 0x18, 0x6c, 0xa4, 0xb6, 0x18, 0x43, 0x72, 0xbd,
+	0x8e, 0xbe, 0xa6, 0x60, 0x88, 0x0d, 0x5e, 0x02, 0x93, 0x35, 0x29, 0xbf, 0x6b, 0x1b, 0xe8, 0xeb,
+	0x09, 0x6f, 0x1b, 0x14, 0x55, 0x8d, 0x51, 0x36, 0xfa, 0x46, 0x02, 0x65, 0xc7, 0x09, 0xa4, 0xa0,
+	0x9b, 0xe8, 0x9b, 0x72, 0x02, 0x09, 0x48, 0xca, 0x32, 0xdd, 0x9d, 0x83, 0xbe, 0x95, 0x00, 0x39,
+	0xd8, 0x9f, 0x14, 0xd3, 0xad, 0x5a, 0x0d, 0x7d, 0x3b, 0x81, 0xba, 0x85, 0x51, 0x52, 0x4c, 0x9b,
+	0xb5, 0x1a, 0xfa, 0x4e, 0x22, 0xaa, 0xcd, 0xc5, 0xe7, 0x60, 0x42, 0x7d, 0xd0, 0x29, 0x00, 0xc3,
+	0x63, 0x6f, 0x44, 0x0d, 0x0f, 0xbe, 0x0d, 0xf2, 0xf5, 0x40, 0xbc, 0xd4, 0x40, 0xb9, 0xd3, 0x5e,
+	0x80, 0xc8, 0xe8, 0xc5, 0x7b, 0x00, 0x26, 0x87, 0x94, 0xb0, 0x08, 0xcc, 0x97, 0xfe, 0x09, 0x73,
+	0x81, 0x7f, 0x85, 0xb3, 0xe0, 0x0c, 0xbd, 0x7d, 0x72, 0xc4, 0x46, 0xbf, 0xdc, 0xc9, 0x6d, 0x1a,
+	0x31, 0x83, 0x3c, 0x90, 0x94, 0x19, 0xcc, 0x14, 0x06, 0x53, 0x66, 0x28, 0x83, 0xd9, 0xb4, 0xd1,
+	0xa3, 0xcc, 0x31, 0x91, 0xc2, 0x31, 0x91, 0xce, 0xa1, 0x8c, 0x18, 0x65, 0x8e, 0xe1, 0x14, 0x8e,
+	0xe1, 0x24, 0x47, 0x62, 0x94, 0x28, 0x73, 0x4c, 0xa7, 0x70, 0x4c, 0xa7, 0x73, 0x28, 0x23, 0x43,
+	0x99, 0x03, 0xa6, 0x70, 0x40, 0x99, 0xe3, 0x01, 0x98, 0x4f, 0x1f, 0x0c, 0xca, 0x2c, 0xa3, 0x29,
+	0x2c, 0xa3, 0x19, 0x2c, 0xea, 0xf0, 0x4f, 0x66, 0x19, 0x49, 0x61, 0x19, 0x91, 0x59, 0xaa, 0x00,
+	0x65, 0x8d, 0xf7, 0x64, 0x9e, 0xa9, 0x14, 0x9e, 0xa9, 0x2c, 0x1e, 0x6d, 0x7c, 0x27, 0xf3, 0x14,
+	0x53, 0x78, 0x8a, 0xa9, 0xdd, 0x26, 0x0f, 0xe9, 0x4e, 0xeb, 0xd7, 0x9c, 0xcc, 0xb0, 0x05, 0x66,
+	0x52, 0xe6, 0x71, 0xa7, 0x51, 0x18, 0x32, 0xc5, 0x5d, 0x50, 0xd4, 0x87, 0x6f, 0xf2, 0xfa, 0xb1,
+	0x94, 0xf5, 0x63, 0x29, 0x4d, 0xa2, 0x0f, 0xda, 0x64, 0x8e, 0xf1, 0x14, 0x8e, 0xf1, 0xe4, 0x36,
+	0xf4, 0x89, 0xda, 0x69, 0x14, 0x05, 0x99, 0x22, 0x04, 0xe7, 0xfa, 0x8c, 0xcc, 0x52, 0xa8, 0xde,
+	0x91, 0xa9, 0x5e, 0xe3, 0x7d, 0x95, 0xe4, 0xf3, 0x18, 0x9c, 0xef, 0x37, 0x33, 0x4b, 0x71, 0xba,
+	0xa6, 0x3a, 0xed, 0xfb, 0x0a, 0x4b, 0x72, 0xd4, 0xa4, 0x0d, 0x97, 0x36, 0x2b, 0x4b, 0x71, 0x72,
+	0x47, 0x76, 0x32, 0xe8, 0x4b, 0x2d, 0xc9, 0x9b, 0x07, 0xce, 0x66, 0xce, 0xcb, 0x52, 0xdc, 0xad,
+	0xa8, 0xee, 0xb2, 0x5f, 0x75, 0xc5, 0x2e, 0x96, 0x6e, 0x03, 0x20, 0x4d, 0xf6, 0x46, 0x81, 0x59,
+	0xdd, 0xdb, 0x2b, 0x0e, 0xe1, 0x5f, 0xca, 0x5b, 0x6e, 0xd1, 0xa0, 0xbf, 0x3c, 0x2f, 0xe6, 0xb0,
+	0xbb, 0xdd, 0xca, 0xc3, 0xe2, 0x7f, 0xf9, 0x7f, 0x46, 0x79, 0x42, 0x8c, 0xa2, 0xf0, 0xa9, 0xb2,
+	0xf4, 0x06, 0x98, 0xd4, 0x06, 0x92, 0x05, 0x60, 0xd4, 0xf9, 0x81, 0x52, 0xbf, 0x76, 0x13, 0x80,
+	0xf8, 0xdf, 0x30, 0xc1, 0x29, 0x90, 0x3f, 0xd8, 0xdd, 0x7f, 0x52, 0xb9, 0xbf, 0x53, 0xdd, 0xa9,
+	0x3c, 0x28, 0x0e, 0xc1, 0x02, 0x18, 0x7b, 0xe2, 0xee, 0x3d, 0xdd, 0x2b, 0x1f, 0x54, 0x8b, 0x06,
+	0x1c, 0x03, 0xc3, 0x8f, 0xf6, 0xf7, 0x76, 0x8b, 0xb9, 0x6b, 0xf7, 0x40, 0x5e, 0x9e, 0x07, 0x4e,
+	0x81, 0x7c, 0x75, 0xcf, 0xad, 0xec, 0x3c, 0xdc, 0xad, 0xd1, 0x48, 0x25, 0x03, 0x8d, 0x58, 0x31,
+	0x3c, 0x2f, 0xe6, 0xca, 0x17, 0xc1, 0x85, 0x7a, 0xd0, 0x4a, 0xfc, 0x61, 0x26, 0x25, 0xe7, 0xc5,
+	0x08, 0xb1, 0x6e, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x33, 0xc2, 0x0c, 0xb6, 0xeb, 0x26, 0x00,
+	0x00,
+}

+ 285 - 0
vendor/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.proto

@@ -0,0 +1,285 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+package conformance;
+option java_package = "com.google.protobuf.conformance";
+
+import "google/protobuf/any.proto";
+import "google/protobuf/duration.proto";
+import "google/protobuf/field_mask.proto";
+import "google/protobuf/struct.proto";
+import "google/protobuf/timestamp.proto";
+import "google/protobuf/wrappers.proto";
+
+// This defines the conformance testing protocol.  This protocol exists between
+// the conformance test suite itself and the code being tested.  For each test,
+// the suite will send a ConformanceRequest message and expect a
+// ConformanceResponse message.
+//
+// You can either run the tests in two different ways:
+//
+//   1. in-process (using the interface in conformance_test.h).
+//
+//   2. as a sub-process communicating over a pipe.  Information about how to
+//      do this is in conformance_test_runner.cc.
+//
+// Pros/cons of the two approaches:
+//
+//   - running as a sub-process is much simpler for languages other than C/C++.
+//
+//   - running as a sub-process may be more tricky in unusual environments like
+//     iOS apps, where fork/stdin/stdout are not available.
+
+enum WireFormat {
+  UNSPECIFIED = 0;
+  PROTOBUF = 1;
+  JSON = 2;
+}
+
+// Represents a single test case's input.  The testee should:
+//
+//   1. parse this proto (which should always succeed)
+//   2. parse the protobuf or JSON payload in "payload" (which may fail)
+//   3. if the parse succeeded, serialize the message in the requested format.
+message ConformanceRequest {
+  // The payload (whether protobuf of JSON) is always for a TestAllTypes proto
+  // (see below).
+  oneof payload {
+    bytes protobuf_payload = 1;
+    string json_payload = 2;
+  }
+
+  // Which format should the testee serialize its message to?
+  WireFormat requested_output_format = 3;
+}
+
+// Represents a single test case's output.
+message ConformanceResponse {
+  oneof result {
+    // This string should be set to indicate parsing failed.  The string can
+    // provide more information about the parse error if it is available.
+    //
+    // Setting this string does not necessarily mean the testee failed the
+    // test.  Some of the test cases are intentionally invalid input.
+    string parse_error = 1;
+
+    // If the input was successfully parsed but errors occurred when
+    // serializing it to the requested output format, set the error message in
+    // this field.
+    string serialize_error = 6;
+
+    // This should be set if some other error occurred.  This will always
+    // indicate that the test failed.  The string can provide more information
+    // about the failure.
+    string runtime_error = 2;
+
+    // If the input was successfully parsed and the requested output was
+    // protobuf, serialize it to protobuf and set it in this field.
+    bytes protobuf_payload = 3;
+
+    // If the input was successfully parsed and the requested output was JSON,
+    // serialize to JSON and set it in this field.
+    string json_payload = 4;
+
+    // For when the testee skipped the test, likely because a certain feature
+    // wasn't supported, like JSON input/output.
+    string skipped = 5;
+  }
+}
+
+// This proto includes every type of field in both singular and repeated
+// forms.
+message TestAllTypes {
+  message NestedMessage {
+    int32 a = 1;
+    TestAllTypes corecursive = 2;
+  }
+
+  enum NestedEnum {
+    FOO = 0;
+    BAR = 1;
+    BAZ = 2;
+    NEG = -1;  // Intentionally negative.
+  }
+
+  // Singular
+  int32 optional_int32    =  1;
+  int64 optional_int64    =  2;
+  uint32 optional_uint32   =  3;
+  uint64 optional_uint64   =  4;
+  sint32 optional_sint32   =  5;
+  sint64 optional_sint64   =  6;
+  fixed32 optional_fixed32  =  7;
+  fixed64 optional_fixed64  =  8;
+  sfixed32 optional_sfixed32 =  9;
+  sfixed64 optional_sfixed64 = 10;
+  float optional_float    = 11;
+  double optional_double   = 12;
+  bool optional_bool     = 13;
+  string optional_string   = 14;
+  bytes optional_bytes    = 15;
+
+  NestedMessage                        optional_nested_message  = 18;
+  ForeignMessage                       optional_foreign_message = 19;
+
+  NestedEnum                           optional_nested_enum     = 21;
+  ForeignEnum                          optional_foreign_enum    = 22;
+
+  string optional_string_piece = 24 [ctype=STRING_PIECE];
+  string optional_cord = 25 [ctype=CORD];
+
+  TestAllTypes recursive_message = 27;
+
+  // Repeated
+  repeated    int32 repeated_int32    = 31;
+  repeated    int64 repeated_int64    = 32;
+  repeated   uint32 repeated_uint32   = 33;
+  repeated   uint64 repeated_uint64   = 34;
+  repeated   sint32 repeated_sint32   = 35;
+  repeated   sint64 repeated_sint64   = 36;
+  repeated  fixed32 repeated_fixed32  = 37;
+  repeated  fixed64 repeated_fixed64  = 38;
+  repeated sfixed32 repeated_sfixed32 = 39;
+  repeated sfixed64 repeated_sfixed64 = 40;
+  repeated    float repeated_float    = 41;
+  repeated   double repeated_double   = 42;
+  repeated     bool repeated_bool     = 43;
+  repeated   string repeated_string   = 44;
+  repeated    bytes repeated_bytes    = 45;
+
+  repeated NestedMessage                        repeated_nested_message  = 48;
+  repeated ForeignMessage                       repeated_foreign_message = 49;
+
+  repeated NestedEnum                           repeated_nested_enum     = 51;
+  repeated ForeignEnum                          repeated_foreign_enum    = 52;
+
+  repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
+  repeated string repeated_cord = 55 [ctype=CORD];
+
+  // Map
+  map <   int32, int32>    map_int32_int32 = 56;
+  map <   int64, int64>    map_int64_int64 = 57;
+  map <  uint32, uint32>   map_uint32_uint32 = 58;
+  map <  uint64, uint64>   map_uint64_uint64 = 59;
+  map <  sint32, sint32>   map_sint32_sint32 = 60;
+  map <  sint64, sint64>   map_sint64_sint64 = 61;
+  map < fixed32, fixed32>  map_fixed32_fixed32 = 62;
+  map < fixed64, fixed64>  map_fixed64_fixed64 = 63;
+  map <sfixed32, sfixed32> map_sfixed32_sfixed32 = 64;
+  map <sfixed64, sfixed64> map_sfixed64_sfixed64 = 65;
+  map <   int32, float>    map_int32_float = 66;
+  map <   int32, double>   map_int32_double = 67;
+  map <    bool, bool>     map_bool_bool = 68;
+  map <  string, string>   map_string_string = 69;
+  map <  string, bytes>    map_string_bytes = 70;
+  map <  string, NestedMessage>  map_string_nested_message = 71;
+  map <  string, ForeignMessage> map_string_foreign_message = 72;
+  map <  string, NestedEnum>     map_string_nested_enum = 73;
+  map <  string, ForeignEnum>    map_string_foreign_enum = 74;
+
+  oneof oneof_field {
+    uint32 oneof_uint32 = 111;
+    NestedMessage oneof_nested_message = 112;
+    string oneof_string = 113;
+    bytes oneof_bytes = 114;
+    bool oneof_bool = 115;
+    uint64 oneof_uint64 = 116;
+    float oneof_float = 117;
+    double oneof_double = 118;
+    NestedEnum oneof_enum = 119;
+  }
+
+  // Well-known types
+  google.protobuf.BoolValue optional_bool_wrapper = 201;
+  google.protobuf.Int32Value optional_int32_wrapper = 202;
+  google.protobuf.Int64Value optional_int64_wrapper = 203;
+  google.protobuf.UInt32Value optional_uint32_wrapper = 204;
+  google.protobuf.UInt64Value optional_uint64_wrapper = 205;
+  google.protobuf.FloatValue optional_float_wrapper = 206;
+  google.protobuf.DoubleValue optional_double_wrapper = 207;
+  google.protobuf.StringValue optional_string_wrapper = 208;
+  google.protobuf.BytesValue optional_bytes_wrapper = 209;
+
+  repeated google.protobuf.BoolValue repeated_bool_wrapper = 211;
+  repeated google.protobuf.Int32Value repeated_int32_wrapper = 212;
+  repeated google.protobuf.Int64Value repeated_int64_wrapper = 213;
+  repeated google.protobuf.UInt32Value repeated_uint32_wrapper = 214;
+  repeated google.protobuf.UInt64Value repeated_uint64_wrapper = 215;
+  repeated google.protobuf.FloatValue repeated_float_wrapper = 216;
+  repeated google.protobuf.DoubleValue repeated_double_wrapper = 217;
+  repeated google.protobuf.StringValue repeated_string_wrapper = 218;
+  repeated google.protobuf.BytesValue repeated_bytes_wrapper = 219;
+
+  google.protobuf.Duration optional_duration = 301;
+  google.protobuf.Timestamp optional_timestamp = 302;
+  google.protobuf.FieldMask optional_field_mask = 303;
+  google.protobuf.Struct optional_struct = 304;
+  google.protobuf.Any optional_any = 305;
+  google.protobuf.Value optional_value = 306;
+
+  repeated google.protobuf.Duration repeated_duration = 311;
+  repeated google.protobuf.Timestamp repeated_timestamp = 312;
+  repeated google.protobuf.FieldMask repeated_fieldmask = 313;
+  repeated google.protobuf.Struct repeated_struct = 324;
+  repeated google.protobuf.Any repeated_any = 315;
+  repeated google.protobuf.Value repeated_value = 316;
+
+  // Test field-name-to-JSON-name convention.
+  // (protobuf says names can be any valid C/C++ identifier.)
+  int32 fieldname1 = 401;
+  int32 field_name2 = 402;
+  int32 _field_name3 = 403;
+  int32 field__name4_ = 404;
+  int32 field0name5 = 405;
+  int32 field_0_name6 = 406;
+  int32 fieldName7 = 407;
+  int32 FieldName8 = 408;
+  int32 field_Name9 = 409;
+  int32 Field_Name10 = 410;
+  int32 FIELD_NAME11 = 411;
+  int32 FIELD_name12 = 412;
+  int32 __field_name13 = 413;
+  int32 __Field_name14 = 414;
+  int32 field__name15 = 415;
+  int32 field__Name16 = 416;
+  int32 field_name17__ = 417;
+  int32 Field_name18__ = 418;
+}
+
+message ForeignMessage {
+  int32 c = 1;
+}
+
+enum ForeignEnum {
+  FOREIGN_FOO = 0;
+  FOREIGN_BAR = 1;
+  FOREIGN_BAZ = 2;
+}

+ 190 - 0
vendor/github.com/gogo/protobuf/bench.md

@@ -0,0 +1,190 @@
+# Benchmarks
+
+## How to reproduce
+
+For a comparison run:
+
+    make bench
+
+followed by [benchcmp](http://code.google.com/p/go/source/browse/misc/benchcmp benchcmp) on the resulting files:
+
+    $GOROOT/misc/benchcmp $GOPATH/src/github.com/gogo/protobuf/test/mixbench/marshal.txt $GOPATH/src/github.com/gogo/protobuf/test/mixbench/marshaler.txt
+    $GOROOT/misc/benchcmp $GOPATH/src/github.com/gogo/protobuf/test/mixbench/unmarshal.txt $GOPATH/src/github.com/gogo/protobuf/test/mixbench/unmarshaler.txt
+
+Benchmarks ran on Revision:  11c56be39364
+
+June 2013
+
+Processor 2,66 GHz Intel Core i7 
+
+Memory 8 GB 1067 MHz DDR3 
+
+## Marshaler
+
+<table>
+<tr><td>benchmark</td><td>old ns/op</td><td>new ns/op</td><td>delta</td></tr>
+<tr><td>BenchmarkNidOptNativeProtoMarshal</td><td>2656</td><td>889</td><td>-66.53%</td></tr>
+<tr><td>BenchmarkNinOptNativeProtoMarshal</td><td>2651</td><td>1015</td><td>-61.71%</td></tr>
+<tr><td>BenchmarkNidRepNativeProtoMarshal</td><td>42661</td><td>12519</td><td>-70.65%</td></tr>
+<tr><td>BenchmarkNinRepNativeProtoMarshal</td><td>42306</td><td>12354</td><td>-70.80%</td></tr>
+<tr><td>BenchmarkNidRepPackedNativeProtoMarshal</td><td>34148</td><td>11902</td><td>-65.15%</td></tr>
+<tr><td>BenchmarkNinRepPackedNativeProtoMarshal</td><td>33375</td><td>11969</td><td>-64.14%</td></tr>
+<tr><td>BenchmarkNidOptStructProtoMarshal</td><td>7148</td><td>3727</td><td>-47.86%</td></tr>
+<tr><td>BenchmarkNinOptStructProtoMarshal</td><td>6956</td><td>3481</td><td>-49.96%</td></tr>
+<tr><td>BenchmarkNidRepStructProtoMarshal</td><td>46551</td><td>19492</td><td>-58.13%</td></tr>
+<tr><td>BenchmarkNinRepStructProtoMarshal</td><td>46715</td><td>19043</td><td>-59.24%</td></tr>
+<tr><td>BenchmarkNidEmbeddedStructProtoMarshal</td><td>5231</td><td>2050</td><td>-60.81%</td></tr>
+<tr><td>BenchmarkNinEmbeddedStructProtoMarshal</td><td>4665</td><td>2000</td><td>-57.13%</td></tr>
+<tr><td>BenchmarkNidNestedStructProtoMarshal</td><td>181106</td><td>103604</td><td>-42.79%</td></tr>
+<tr><td>BenchmarkNinNestedStructProtoMarshal</td><td>182053</td><td>102069</td><td>-43.93%</td></tr>
+<tr><td>BenchmarkNidOptCustomProtoMarshal</td><td>1209</td><td>310</td><td>-74.36%</td></tr>
+<tr><td>BenchmarkNinOptCustomProtoMarshal</td><td>1435</td><td>277</td><td>-80.70%</td></tr>
+<tr><td>BenchmarkNidRepCustomProtoMarshal</td><td>4126</td><td>763</td><td>-81.51%</td></tr>
+<tr><td>BenchmarkNinRepCustomProtoMarshal</td><td>3972</td><td>769</td><td>-80.64%</td></tr>
+<tr><td>BenchmarkNinOptNativeUnionProtoMarshal</td><td>973</td><td>303</td><td>-68.86%</td></tr>
+<tr><td>BenchmarkNinOptStructUnionProtoMarshal</td><td>1536</td><td>521</td><td>-66.08%</td></tr>
+<tr><td>BenchmarkNinEmbeddedStructUnionProtoMarshal</td><td>2327</td><td>884</td><td>-62.01%</td></tr>
+<tr><td>BenchmarkNinNestedStructUnionProtoMarshal</td><td>2070</td><td>743</td><td>-64.11%</td></tr>
+<tr><td>BenchmarkTreeProtoMarshal</td><td>1554</td><td>838</td><td>-46.07%</td></tr>
+<tr><td>BenchmarkOrBranchProtoMarshal</td><td>3156</td><td>2012</td><td>-36.25%</td></tr>
+<tr><td>BenchmarkAndBranchProtoMarshal</td><td>3183</td><td>1996</td><td>-37.29%</td></tr>
+<tr><td>BenchmarkLeafProtoMarshal</td><td>965</td><td>606</td><td>-37.20%</td></tr>
+<tr><td>BenchmarkDeepTreeProtoMarshal</td><td>2316</td><td>1283</td><td>-44.60%</td></tr>
+<tr><td>BenchmarkADeepBranchProtoMarshal</td><td>2719</td><td>1492</td><td>-45.13%</td></tr>
+<tr><td>BenchmarkAndDeepBranchProtoMarshal</td><td>4663</td><td>2922</td><td>-37.34%</td></tr>
+<tr><td>BenchmarkDeepLeafProtoMarshal</td><td>1849</td><td>1016</td><td>-45.05%</td></tr>
+<tr><td>BenchmarkNilProtoMarshal</td><td>439</td><td>76</td><td>-82.53%</td></tr>
+<tr><td>BenchmarkNidOptEnumProtoMarshal</td><td>514</td><td>152</td><td>-70.43%</td></tr>
+<tr><td>BenchmarkNinOptEnumProtoMarshal</td><td>550</td><td>158</td><td>-71.27%</td></tr>
+<tr><td>BenchmarkNidRepEnumProtoMarshal</td><td>647</td><td>207</td><td>-68.01%</td></tr>
+<tr><td>BenchmarkNinRepEnumProtoMarshal</td><td>662</td><td>213</td><td>-67.82%</td></tr>
+<tr><td>BenchmarkTimerProtoMarshal</td><td>934</td><td>271</td><td>-70.99%</td></tr>
+<tr><td>BenchmarkMyExtendableProtoMarshal</td><td>608</td><td>185</td><td>-69.57%</td></tr>
+<tr><td>BenchmarkOtherExtenableProtoMarshal</td><td>1112</td><td>332</td><td>-70.14%</td></tr>
+</table>
+
+<table>
+<tr><td>benchmark</td><td>old MB/s</td><td>new MB/s</td><td>speedup</td></tr>
+<tr><td>BenchmarkNidOptNativeProtoMarshal</td><td>126.86</td><td>378.86</td><td>2.99x</td></tr>
+<tr><td>BenchmarkNinOptNativeProtoMarshal</td><td>114.27</td><td>298.42</td><td>2.61x</td></tr>
+<tr><td>BenchmarkNidRepNativeProtoMarshal</td><td>164.25</td><td>561.20</td><td>3.42x</td></tr>
+<tr><td>BenchmarkNinRepNativeProtoMarshal</td><td>166.10</td><td>568.23</td><td>3.42x</td></tr>
+<tr><td>BenchmarkNidRepPackedNativeProtoMarshal</td><td>99.10</td><td>283.97</td><td>2.87x</td></tr>
+<tr><td>BenchmarkNinRepPackedNativeProtoMarshal</td><td>101.30</td><td>282.31</td><td>2.79x</td></tr>
+<tr><td>BenchmarkNidOptStructProtoMarshal</td><td>176.83</td><td>339.07</td><td>1.92x</td></tr>
+<tr><td>BenchmarkNinOptStructProtoMarshal</td><td>163.59</td><td>326.57</td><td>2.00x</td></tr>
+<tr><td>BenchmarkNidRepStructProtoMarshal</td><td>178.84</td><td>427.49</td><td>2.39x</td></tr>
+<tr><td>BenchmarkNinRepStructProtoMarshal</td><td>178.70</td><td>437.69</td><td>2.45x</td></tr>
+<tr><td>BenchmarkNidEmbeddedStructProtoMarshal</td><td>124.24</td><td>317.56</td><td>2.56x</td></tr>
+<tr><td>BenchmarkNinEmbeddedStructProtoMarshal</td><td>132.03</td><td>307.99</td><td>2.33x</td></tr>
+<tr><td>BenchmarkNidNestedStructProtoMarshal</td><td>192.91</td><td>337.86</td><td>1.75x</td></tr>
+<tr><td>BenchmarkNinNestedStructProtoMarshal</td><td>192.44</td><td>344.45</td><td>1.79x</td></tr>
+<tr><td>BenchmarkNidOptCustomProtoMarshal</td><td>29.77</td><td>116.03</td><td>3.90x</td></tr>
+<tr><td>BenchmarkNinOptCustomProtoMarshal</td><td>22.29</td><td>115.38</td><td>5.18x</td></tr>
+<tr><td>BenchmarkNidRepCustomProtoMarshal</td><td>35.14</td><td>189.80</td><td>5.40x</td></tr>
+<tr><td>BenchmarkNinRepCustomProtoMarshal</td><td>36.50</td><td>188.40</td><td>5.16x</td></tr>
+<tr><td>BenchmarkNinOptNativeUnionProtoMarshal</td><td>32.87</td><td>105.39</td><td>3.21x</td></tr>
+<tr><td>BenchmarkNinOptStructUnionProtoMarshal</td><td>66.40</td><td>195.76</td><td>2.95x</td></tr>
+<tr><td>BenchmarkNinEmbeddedStructUnionProtoMarshal</td><td>93.24</td><td>245.26</td><td>2.63x</td></tr>
+<tr><td>BenchmarkNinNestedStructUnionProtoMarshal</td><td>57.49</td><td>160.06</td><td>2.78x</td></tr>
+<tr><td>BenchmarkTreeProtoMarshal</td><td>137.64</td><td>255.12</td><td>1.85x</td></tr>
+<tr><td>BenchmarkOrBranchProtoMarshal</td><td>137.80</td><td>216.10</td><td>1.57x</td></tr>
+<tr><td>BenchmarkAndBranchProtoMarshal</td><td>136.64</td><td>217.89</td><td>1.59x</td></tr>
+<tr><td>BenchmarkLeafProtoMarshal</td><td>214.48</td><td>341.53</td><td>1.59x</td></tr>
+<tr><td>BenchmarkDeepTreeProtoMarshal</td><td>95.85</td><td>173.03</td><td>1.81x</td></tr>
+<tr><td>BenchmarkADeepBranchProtoMarshal</td><td>82.73</td><td>150.78</td><td>1.82x</td></tr>
+<tr><td>BenchmarkAndDeepBranchProtoMarshal</td><td>96.72</td><td>153.98</td><td>1.59x</td></tr>
+<tr><td>BenchmarkDeepLeafProtoMarshal</td><td>117.34</td><td>213.41</td><td>1.82x</td></tr>
+<tr><td>BenchmarkNidOptEnumProtoMarshal</td><td>3.89</td><td>13.16</td><td>3.38x</td></tr>
+<tr><td>BenchmarkNinOptEnumProtoMarshal</td><td>1.82</td><td>6.30</td><td>3.46x</td></tr>
+<tr><td>BenchmarkNidRepEnumProtoMarshal</td><td>12.36</td><td>38.50</td><td>3.11x</td></tr>
+<tr><td>BenchmarkNinRepEnumProtoMarshal</td><td>12.08</td><td>37.53</td><td>3.11x</td></tr>
+<tr><td>BenchmarkTimerProtoMarshal</td><td>73.81</td><td>253.87</td><td>3.44x</td></tr>
+<tr><td>BenchmarkMyExtendableProtoMarshal</td><td>13.15</td><td>43.08</td><td>3.28x</td></tr>
+<tr><td>BenchmarkOtherExtenableProtoMarshal</td><td>24.28</td><td>81.09</td><td>3.34x</td></tr>
+</table>
+
+## Unmarshaler
+
+<table>
+<tr><td>benchmark</td><td>old ns/op</td><td>new ns/op</td><td>delta</td></tr>
+<tr><td>BenchmarkNidOptNativeProtoUnmarshal</td><td>2521</td><td>1006</td><td>-60.10%</td></tr>
+<tr><td>BenchmarkNinOptNativeProtoUnmarshal</td><td>2529</td><td>1750</td><td>-30.80%</td></tr>
+<tr><td>BenchmarkNidRepNativeProtoUnmarshal</td><td>49067</td><td>35299</td><td>-28.06%</td></tr>
+<tr><td>BenchmarkNinRepNativeProtoUnmarshal</td><td>47990</td><td>35456</td><td>-26.12%</td></tr>
+<tr><td>BenchmarkNidRepPackedNativeProtoUnmarshal</td><td>26456</td><td>23950</td><td>-9.47%</td></tr>
+<tr><td>BenchmarkNinRepPackedNativeProtoUnmarshal</td><td>26499</td><td>24037</td><td>-9.29%</td></tr>
+<tr><td>BenchmarkNidOptStructProtoUnmarshal</td><td>6803</td><td>3873</td><td>-43.07%</td></tr>
+<tr><td>BenchmarkNinOptStructProtoUnmarshal</td><td>6786</td><td>4154</td><td>-38.79%</td></tr>
+<tr><td>BenchmarkNidRepStructProtoUnmarshal</td><td>56276</td><td>31970</td><td>-43.19%</td></tr>
+<tr><td>BenchmarkNinRepStructProtoUnmarshal</td><td>48750</td><td>31832</td><td>-34.70%</td></tr>
+<tr><td>BenchmarkNidEmbeddedStructProtoUnmarshal</td><td>4556</td><td>1973</td><td>-56.69%</td></tr>
+<tr><td>BenchmarkNinEmbeddedStructProtoUnmarshal</td><td>4485</td><td>1975</td><td>-55.96%</td></tr>
+<tr><td>BenchmarkNidNestedStructProtoUnmarshal</td><td>223395</td><td>135844</td><td>-39.19%</td></tr>
+<tr><td>BenchmarkNinNestedStructProtoUnmarshal</td><td>226446</td><td>134022</td><td>-40.82%</td></tr>
+<tr><td>BenchmarkNidOptCustomProtoUnmarshal</td><td>1859</td><td>300</td><td>-83.86%</td></tr>
+<tr><td>BenchmarkNinOptCustomProtoUnmarshal</td><td>1486</td><td>402</td><td>-72.95%</td></tr>
+<tr><td>BenchmarkNidRepCustomProtoUnmarshal</td><td>8229</td><td>1669</td><td>-79.72%</td></tr>
+<tr><td>BenchmarkNinRepCustomProtoUnmarshal</td><td>8253</td><td>1649</td><td>-80.02%</td></tr>
+<tr><td>BenchmarkNinOptNativeUnionProtoUnmarshal</td><td>840</td><td>307</td><td>-63.45%</td></tr>
+<tr><td>BenchmarkNinOptStructUnionProtoUnmarshal</td><td>1395</td><td>639</td><td>-54.19%</td></tr>
+<tr><td>BenchmarkNinEmbeddedStructUnionProtoUnmarshal</td><td>2297</td><td>1167</td><td>-49.19%</td></tr>
+<tr><td>BenchmarkNinNestedStructUnionProtoUnmarshal</td><td>1820</td><td>889</td><td>-51.15%</td></tr>
+<tr><td>BenchmarkTreeProtoUnmarshal</td><td>1521</td><td>720</td><td>-52.66%</td></tr>
+<tr><td>BenchmarkOrBranchProtoUnmarshal</td><td>2669</td><td>1385</td><td>-48.11%</td></tr>
+<tr><td>BenchmarkAndBranchProtoUnmarshal</td><td>2667</td><td>1420</td><td>-46.76%</td></tr>
+<tr><td>BenchmarkLeafProtoUnmarshal</td><td>1171</td><td>584</td><td>-50.13%</td></tr>
+<tr><td>BenchmarkDeepTreeProtoUnmarshal</td><td>2065</td><td>1081</td><td>-47.65%</td></tr>
+<tr><td>BenchmarkADeepBranchProtoUnmarshal</td><td>2695</td><td>1178</td><td>-56.29%</td></tr>
+<tr><td>BenchmarkAndDeepBranchProtoUnmarshal</td><td>4055</td><td>1918</td><td>-52.70%</td></tr>
+<tr><td>BenchmarkDeepLeafProtoUnmarshal</td><td>1758</td><td>865</td><td>-50.80%</td></tr>
+<tr><td>BenchmarkNilProtoUnmarshal</td><td>564</td><td>63</td><td>-88.79%</td></tr>
+<tr><td>BenchmarkNidOptEnumProtoUnmarshal</td><td>762</td><td>73</td><td>-90.34%</td></tr>
+<tr><td>BenchmarkNinOptEnumProtoUnmarshal</td><td>764</td><td>163</td><td>-78.66%</td></tr>
+<tr><td>BenchmarkNidRepEnumProtoUnmarshal</td><td>1078</td><td>447</td><td>-58.53%</td></tr>
+<tr><td>BenchmarkNinRepEnumProtoUnmarshal</td><td>1071</td><td>479</td><td>-55.28%</td></tr>
+<tr><td>BenchmarkTimerProtoUnmarshal</td><td>1128</td><td>362</td><td>-67.91%</td></tr>
+<tr><td>BenchmarkMyExtendableProtoUnmarshal</td><td>808</td><td>217</td><td>-73.14%</td></tr>
+<tr><td>BenchmarkOtherExtenableProtoUnmarshal</td><td>1233</td><td>517</td><td>-58.07%</td></tr>
+</table>
+
+<table>
+<tr><td>benchmark</td><td>old MB/s</td><td>new MB/s</td><td>speedup</td></tr>
+<tr><td>BenchmarkNidOptNativeProtoUnmarshal</td><td>133.67</td><td>334.98</td><td>2.51x</td></tr>
+<tr><td>BenchmarkNinOptNativeProtoUnmarshal</td><td>119.77</td><td>173.08</td><td>1.45x</td></tr>
+<tr><td>BenchmarkNidRepNativeProtoUnmarshal</td><td>143.23</td><td>199.12</td><td>1.39x</td></tr>
+<tr><td>BenchmarkNinRepNativeProtoUnmarshal</td><td>146.07</td><td>198.16</td><td>1.36x</td></tr>
+<tr><td>BenchmarkNidRepPackedNativeProtoUnmarshal</td><td>127.80</td><td>141.04</td><td>1.10x</td></tr>
+<tr><td>BenchmarkNinRepPackedNativeProtoUnmarshal</td><td>127.55</td><td>140.78</td><td>1.10x</td></tr>
+<tr><td>BenchmarkNidOptStructProtoUnmarshal</td><td>185.79</td><td>326.31</td><td>1.76x</td></tr>
+<tr><td>BenchmarkNinOptStructProtoUnmarshal</td><td>167.68</td><td>273.66</td><td>1.63x</td></tr>
+<tr><td>BenchmarkNidRepStructProtoUnmarshal</td><td>147.88</td><td>260.39</td><td>1.76x</td></tr>
+<tr><td>BenchmarkNinRepStructProtoUnmarshal</td><td>171.20</td><td>261.97</td><td>1.53x</td></tr>
+<tr><td>BenchmarkNidEmbeddedStructProtoUnmarshal</td><td>142.86</td><td>329.42</td><td>2.31x</td></tr>
+<tr><td>BenchmarkNinEmbeddedStructProtoUnmarshal</td><td>137.33</td><td>311.83</td><td>2.27x</td></tr>
+<tr><td>BenchmarkNidNestedStructProtoUnmarshal</td><td>154.97</td><td>259.47</td><td>1.67x</td></tr>
+<tr><td>BenchmarkNinNestedStructProtoUnmarshal</td><td>154.32</td><td>258.42</td><td>1.67x</td></tr>
+<tr><td>BenchmarkNidOptCustomProtoUnmarshal</td><td>19.36</td><td>119.66</td><td>6.18x</td></tr>
+<tr><td>BenchmarkNinOptCustomProtoUnmarshal</td><td>21.52</td><td>79.50</td><td>3.69x</td></tr>
+<tr><td>BenchmarkNidRepCustomProtoUnmarshal</td><td>17.62</td><td>86.86</td><td>4.93x</td></tr>
+<tr><td>BenchmarkNinRepCustomProtoUnmarshal</td><td>17.57</td><td>87.92</td><td>5.00x</td></tr>
+<tr><td>BenchmarkNinOptNativeUnionProtoUnmarshal</td><td>38.07</td><td>104.12</td><td>2.73x</td></tr>
+<tr><td>BenchmarkNinOptStructUnionProtoUnmarshal</td><td>73.08</td><td>159.54</td><td>2.18x</td></tr>
+<tr><td>BenchmarkNinEmbeddedStructUnionProtoUnmarshal</td><td>94.00</td><td>185.92</td><td>1.98x</td></tr>
+<tr><td>BenchmarkNinNestedStructUnionProtoUnmarshal</td><td>65.35</td><td>133.75</td><td>2.05x</td></tr>
+<tr><td>BenchmarkTreeProtoUnmarshal</td><td>141.28</td><td>297.13</td><td>2.10x</td></tr>
+<tr><td>BenchmarkOrBranchProtoUnmarshal</td><td>162.56</td><td>313.96</td><td>1.93x</td></tr>
+<tr><td>BenchmarkAndBranchProtoUnmarshal</td><td>163.06</td><td>306.15</td><td>1.88x</td></tr>
+<tr><td>BenchmarkLeafProtoUnmarshal</td><td>176.72</td><td>354.19</td><td>2.00x</td></tr>
+<tr><td>BenchmarkDeepTreeProtoUnmarshal</td><td>107.50</td><td>205.30</td><td>1.91x</td></tr>
+<tr><td>BenchmarkADeepBranchProtoUnmarshal</td><td>83.48</td><td>190.88</td><td>2.29x</td></tr>
+<tr><td>BenchmarkAndDeepBranchProtoUnmarshal</td><td>110.97</td><td>234.60</td><td>2.11x</td></tr>
+<tr><td>BenchmarkDeepLeafProtoUnmarshal</td><td>123.40</td><td>250.73</td><td>2.03x</td></tr>
+<tr><td>BenchmarkNidOptEnumProtoUnmarshal</td><td>2.62</td><td>27.16</td><td>10.37x</td></tr>
+<tr><td>BenchmarkNinOptEnumProtoUnmarshal</td><td>1.31</td><td>6.11</td><td>4.66x</td></tr>
+<tr><td>BenchmarkNidRepEnumProtoUnmarshal</td><td>7.42</td><td>17.88</td><td>2.41x</td></tr>
+<tr><td>BenchmarkNinRepEnumProtoUnmarshal</td><td>7.47</td><td>16.69</td><td>2.23x</td></tr>
+<tr><td>BenchmarkTimerProtoUnmarshal</td><td>61.12</td><td>190.34</td><td>3.11x</td></tr>
+<tr><td>BenchmarkMyExtendableProtoUnmarshal</td><td>9.90</td><td>36.71</td><td>3.71x</td></tr>
+<tr><td>BenchmarkOtherExtenableProtoUnmarshal</td><td>21.90</td><td>52.13</td><td>2.38x</td></tr>
+</table>

+ 4 - 2
vendor/github.com/gogo/protobuf/codec/codec.go

@@ -1,5 +1,7 @@
-// Copyright (c) 2015, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2015, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // modification, are permitted provided that the following conditions are

+ 54 - 0
vendor/github.com/gogo/protobuf/codec/codec_test.go

@@ -0,0 +1,54 @@
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2015, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package codec
+
+import (
+	"github.com/gogo/protobuf/test"
+	"math/rand"
+	"testing"
+	"time"
+)
+
+func TestCodec(t *testing.T) {
+	r := rand.New(rand.NewSource(time.Now().UnixNano()))
+	in := test.NewPopulatedNinOptStruct(r, true)
+	c := New(r.Intn(1024))
+	data, err := c.Marshal(in)
+	if err != nil {
+		t.Fatal(err)
+	}
+	out := &test.NinOptStruct{}
+	err = c.Unmarshal(data, out)
+	if err != nil {
+		t.Fatal(err)
+	}
+	if err := in.VerboseEqual(out); err != nil {
+		t.Fatal(err)
+	}
+}

+ 167 - 0
vendor/github.com/gogo/protobuf/extensions.md

@@ -0,0 +1,167 @@
+# gogoprotobuf Extensions
+
+Here is an [example.proto](https://github.com/gogo/protobuf/blob/master/test/example/example.proto) which uses most of the gogoprotobuf code generation plugins.
+
+Please also look at the example [Makefile](https://github.com/gogo/protobuf/blob/master/test/example/Makefile) which shows how to specify the `descriptor.proto` and `gogo.proto` in your proto_path
+
+The documentation at [http://godoc.org/github.com/gogo/protobuf/gogoproto](http://godoc.org/github.com/gogo/protobuf/gogoproto) describes the extensions made to goprotobuf in more detail.
+
+Also see [http://godoc.org/github.com/gogo/protobuf/plugin/](http://godoc.org/github.com/gogo/protobuf/plugin/) for documentation of each of the extensions which have their own plugins.
+
+# Fast Marshalling and Unmarshalling
+
+Generating a `Marshal`, `MarshalTo`, `Size` (or `ProtoSize`) and `Unmarshal` method for a struct results in faster marshalling and unmarshalling than when using reflect.
+
+See [BenchComparison](https://github.com/gogo/protobuf/blob/master/bench.md) for a comparison between reflect and generated code used for marshalling and unmarshalling.
+
+<table>
+<tr><td><b>Name</b></td><td><b>Option</b></td><td><b>Type</b></td><td><b>Description</b></td><td><b>Default</b></td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/marshalto">marshaler</a></td><td>Message</td><td>bool</td><td>if true, a Marshal and MarshalTo method is generated for the specific message</td><td>false</td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/size">sizer</a></td><td>Message</td><td>bool</td><td>if true, a Size method is generated for the specific message</td><td>false</td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/unmarshal">unmarshaler</a></td><td> Message </td><td> bool </td><td> if true, an Unmarshal method is generated for the specific message </td><td> false</td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/size">protosizer</a></td><td>Message</td><td>bool</td><td>if true, a ProtoSize method is generated for the specific message</td><td>false</td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/marshalto"> unsafe_marshaler</a> </td><td> Message </td><td> bool </td><td> if true, a Marshal and MarshalTo method is generated for the specific message. The generated code uses the unsafe package. </td><td> false</td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/unmarshal">unsafe_unmarshaler</a></td><td> Message </td><td> bool </td><td> if true, an Unmarshal method is generated for the specific message. The generated code uses the unsafe package. </td><td> false</td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/marshalto">stable_marshaler</a></td><td> Message </td><td> bool </td><td> if true, a Marshal and MarshalTo method is generated for the specific message, but unlike marshaler the output is guaranteed to be deterministic, at the sacrifice of some speed</td><td> false </td></tr>
+</table>
+
+# More Canonical Go Structures
+
+Lots of times working with a goprotobuf struct will lead you to a place where you create another struct that is easier to work with and then have a function to copy the values between the two structs.
+
+You might also find that basic structs that started their life as part of an API need to be sent over the wire. With gob, you could just send it. With goprotobuf, you need to make a new struct.
+
+`gogoprotobuf` tries to fix these problems with the nullable, embed, customtype, customname, casttype, castkey and castvalue field extensions.
+
+<table>
+<tr><td><b>Name</b></td><td><b>Option</b></td><td><b>Type</b></td><td><b>Description</b></td><td><b>Default</b></td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/gogoproto">nullable</a></td><td> Field </td><td> bool </td><td> if false, a field is generated without a pointer (see warning below). </td><td> true </td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/gogoproto">embed</a></td><td> Field </td><td> bool </td><td> if true, the field is generated as an embedded field. </td><td> false </td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/gogoproto">customtype</a> </td><td> Field </td><td> string </td><td> It works with the Marshal and Unmarshal methods, to allow you to have your own types in your struct, but marshal to bytes. For example, custom.Uuid or custom.Fixed128 </td><td> goprotobuf type </td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/gogoproto"> customname</a> (beta) </td><td> Field </td><td> string </td><td> Changes the generated fieldname. This is especially useful when generated methods conflict with fieldnames. </td><td> goprotobuf field name </td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/gogoproto"> casttype</a> (beta) </td><td> Field </td><td> string </td><td> Changes the generated field type. It assumes that this type is castable to the original goprotobuf field type.  It currently does not support maps, structs or enums. </td><td> goprotobuf field type </td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/gogoproto"> castkey </a> (beta) </td><td> Field </td><td> string </td><td> Changes the generated fieldtype for a map key.  All generated code assumes that this type is castable to the protocol buffer field type.  Only supported on maps. </td><td> goprotobuf field type </td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/gogoproto"> castvalue </a> (beta) </td><td> Field </td><td> string </td><td> Changes the generated fieldtype for a map value.  All generated code assumes that this type is castable to the protocol buffer field type.  Only supported on maps. </td><td> goprotobuf field type </td></tr>
+<tr><td>enum_customname  (beta)</td><td> Enum </td><td> string </td><td>Sets the type name of an enum. If goproto_enum_prefix is enabled, this value will be used as a prefix when generating enum values.</td><td>goprotobuf enum type name. Helps with golint issues.</td></tr>
+<tr><td>enumvalue_customname (beta) </td><td> Enum Value </td><td> string </td><td>Changes the generated enum name.  Helps with golint issues.</td><td>goprotobuf enum value name</td></tr>
+<tr><td><a href="https://github.com/gogo/protobuf/blob/master/test/types/types.proto">stdtime</a></td><td> Timestamp Field </td><td> bool </td><td>Changes the Well Known Timestamp Type to time.Time</td><td>Timestamp</td></tr>
+<tr><td><a href="https://github.com/gogo/protobuf/blob/master/test/types/types.proto">stdduration</a></td><td> Duration Field </td><td> bool </td><td>Changes the Well Known Duration Type to time.Duration</td><td>Duration</td></tr>
+</table>
+
+`Warning about nullable: according to the Protocol Buffer specification, you should be able to tell whether a field is set or unset. With the option nullable=false this feature is lost, since your non-nullable fields will always be set.` 
+
+`Warning about customtype: It is your responsibility to test all cases of your marshaling, unmarshaling and size methods implemented for your custom type.`
+
+Issues with customtype include:
+  * <a href="https://github.com/gogo/protobuf/issues/199">A Bytes method is not allowed.<a/>
+  * <a href="https://github.com/gogo/protobuf/issues/132">Defining a customtype as a fake proto message is broken.</a>
+  * <a href="https://github.com/gogo/protobuf/issues/147">proto.Clone is broken.</a>
+  * <a href="https://github.com/gogo/protobuf/issues/125">Using a proto message as a customtype is not allowed.</a>
+  * <a href="https://github.com/gogo/protobuf/issues/200">cusomtype of type map can not UnmarshalText</a>
+  * <a href="https://github.com/gogo/protobuf/issues/201">customtype of type struct cannot jsonpb unmarshal</a>
+
+# Goprotobuf Compatibility 
+
+Gogoprotobuf is compatible with Goprotobuf, because it is compatible with protocol buffers (see the section on tests below).
+
+Gogoprotobuf generates the same code as goprotobuf if no extensions are used.
+
+The enumprefix, getters and stringer extensions can be used to remove some of the unnecessary code generated by goprotobuf.
+
+<table>
+<tr><td><b>Name</b></td><td><b>Option</b></td><td><b>Type</b></td><td><b>Description</b></td><td><b>Default</b></td></tr>
+<tr><td> gogoproto_import </td><td> File </td><td> bool </td><td> if false, the generated code imports github.com/golang/protobuf/proto instead of github.com/gogo/protobuf/proto. </td><td> true </td></tr>
+<tr><td> goproto_enum_prefix </td><td> Enum </td><td> bool </td><td> if false, generates the enum constant names without the messagetype prefix </td><td> true </td></tr>
+<tr><td> goproto_getters </td><td> Message </td><td> bool </td><td> if false, the message is generated without get methods, this is useful when you would rather want to use face </td><td> true </td></tr>
+<tr><td> goproto_stringer </td><td> Message </td><td> bool </td><td> if false, the message is generated without the default string method, this is useful for rather using stringer </td><td> true </td></tr>
+<tr><td> goproto_enum_stringer (experimental) </td><td> Enum </td><td> bool </td><td> if false, the enum is generated without the default string method, this is useful for rather using enum_stringer </td><td> true </td></tr>
+<tr><td> goproto_extensions_map (beta) </td><td> Message </td><td> bool </td><td> if false, the extensions field is generated as type []byte instead of type map[int32]proto.Extension </td><td> true </td></tr>
+<tr><td> goproto_unrecognized (beta) </td><td> Message </td><td> bool </td><td>if false, XXX_unrecognized field is not generated. This is useful to reduce GC pressure at the cost of losing information about unrecognized fields. </td><td> true </td></tr>
+</table>
+
+# Less Typing
+
+The Protocol Buffer language is very parseable and extra code can be easily generated for structures.
+
+Helper methods, functions and interfaces can be generated by triggering certain extensions like gostring.
+
+<table>
+<tr><td><b>Name</b></td><td><b>Option</b></td><td><b>Type</b></td><td><b>Description</b></td><td><b>Default</b></td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/gostring">gostring</a></td><td> Message </td><td> bool </td><td> if true, a `GoString` method is generated. This returns a string representing valid go code to reproduce the current state of the struct. </td><td> false </td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/union"> onlyone</a> (deprecated) </td><td> Message </td><td> bool </td><td> if true, all fields must be nullable and only one of the fields may be set, like a union. Two methods are generated: `GetValue() interface{}` and `SetValue(v interface{}) (set bool)`. These provide easier interaction with a union. </td><td> false </td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/equal"> equal</a></td><td> Message </td><td> bool </td><td> if true, an Equal method is generated </td><td> false </td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/compare"> compare</a></td><td> Message </td><td> bool </td><td> if true, a Compare method is generated.  This is very useful for quickly implementing sort on a list of protobuf structs </td><td> false </td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/equal"> verbose_equal</a> </td><td> Message </td><td> bool </td><td> if true, a verbose equal method is generated for the message. This returns an error which describes the exact element which is not equal to the exact element in the other struct. </td><td> false </td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/stringer"> stringer</a> </td><td> Message </td><td> bool </td><td> if true, a String method is generated for the message. </td><td> false </td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/face">face</a> </td><td> Message </td><td> bool </td><td> if true, a function will be generated which can convert a structure which satisfies an interface (face) to the specified structure. This interface contains getters for each of the fields in the struct. The specified struct is also generated with the getters. This allows it to satisfy its own face. </td><td> false </td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/description"> description</a> (beta) </td><td> Message </td><td> bool </td><td> if true, a Description method is generated for the message. </td><td> false </td></tr>
+<tr><td> <a href="http://godoc.org/github.com/gogo/protobuf/plugin/populate"> populate</a> </td><td> Message </td><td> bool </td><td> if true, a `NewPopulated<MessageName>` function is generated. This is necessary for  generated tests. </td><td> false </td></tr>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/enumstringer"> enum_stringer</a> (experimental) </td><td> Enum </td><td> bool </td><td> if true, a String method is generated for an Enum </td><td> false </td></tr>
+</table>
+
+Issues with Compare include:
+  * <a href="https://github.com/gogo/protobuf/issues/221">Oneof is not supported yet</a>
+  * <a href="https://github.com/gogo/protobuf/issues/230">Not all Well Known Types are supported yet</a>
+  * <a href="https://github.com/gogo/protobuf/issues/231">Maps are not supported</a>
+
+#Peace of Mind
+
+Test and Benchmark generation is done with the following extensions:
+
+<table>
+<tr><td><a href="http://godoc.org/github.com/gogo/protobuf/plugin/testgen">testgen</a> </td><td> Message </td><td> bool </td><td> if true, tests are generated for proto, json and prototext marshalling as well as for some of the other enabled plugins </td><td> false </td></tr>
+<tr><td> benchgen </td><td> Message </td><td> bool </td><td> if true, benchmarks are generated for proto, json and prototext marshalling as well as for some of the other enabled plugins </td><td> false </td></tr>
+</table>
+
+# More Serialization Formats
+
+Other serialization formats like xml and json typically use reflect to marshal and unmarshal structured data.  Manipulating these structs into something other than the default Go requires editing tags.  The following extensions provide ways of editing these tags for the generated protobuf structs.
+
+<table>
+<tr><td><a href="https://github.com/gogo/protobuf/blob/master/test/tags/tags.proto">jsontag</a> (beta) </td><td> Field </td><td> string </td><td> if set, the json tag value between the double quotes is replaced with this string </td><td> fieldname </td></tr>
+<tr><td><a href="https://github.com/gogo/protobuf/blob/master/test/tags/tags.proto">moretags</a> (beta) </td><td> Field </td><td> string </td><td> if set, this string is appended to the tag string </td><td> empty </td></tr>
+</table>
+
+<a href="https://groups.google.com/forum/#!topic/gogoprotobuf/xmFnqAS6MIc">Here is a longer explanation of jsontag and moretags</a>
+
+# File Options 
+
+Each of the boolean message and enum extensions also have a file extension:
+
+  * `marshaler_all`
+  * `sizer_all`
+  * `protosizer_all`
+  * `unmarshaler_all`
+  * `unsafe_marshaler_all`
+  * `unsafe_unmarshaler_all`
+  * `stable_marshaler_all`
+  * `goproto_enum_prefix_all`
+  * `goproto_getters_all`
+  * `goproto_stringer_all`
+  * `goproto_enum_stringer_all`
+  * `goproto_extensions_map_all`
+  * `goproto_unrecognized_all`
+  * `gostring_all`
+  * `onlyone_all`
+  * `equal_all`
+  * `compare_all`
+  * `verbose_equal_all`
+  * `stringer_all`
+  * `enum_stringer_all`
+  * `face_all`
+  * `description_all`
+  * `populate_all`
+  * `testgen_all`
+  * `benchgen_all`
+
+Each of these are the same as their Message Option counterparts, except they apply to all messages in the file.  Their Message option counterparts can also be used to overwrite their effect.
+
+# Tests
+
+  * The normal barrage of tests are run with: `make tests` 
+  * A few weird tests: `make testall`
+  * Tests for compatibility with [golang/protobuf](https://github.com/golang/protobuf) are handled by a different project [harmonytests](https://github.com/gogo/harmonytests), since it requires goprotobuf.
+  * Cross version tests are made with [Travis CI](https://travis-ci.org/gogo/protobuf).
+  * GRPC Tests are also handled by a different project [grpctests](https://github.com/gogo/grpctests), since it depends on a lot of grpc libraries.
+  * Thanks to [go-fuzz](https://github.com/dvyukov/go-fuzz/) we have proper [fuzztests](https://github.com/gogo/fuzztests).
+

+ 37 - 0
vendor/github.com/gogo/protobuf/gogoproto/Makefile

@@ -0,0 +1,37 @@
+# Protocol Buffers for Go with Gadgets
+#
+# Copyright (c) 2013, The GoGo Authors. All rights reserved.
+# http://github.com/gogo/protobuf
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+regenerate:
+	go install github.com/gogo/protobuf/protoc-gen-gogo
+	protoc --gogo_out=Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:. --proto_path=../../../../:../protobuf/:. *.proto
+
+restore:
+	cp gogo.pb.golden gogo.pb.go
+
+preserve:
+	cp gogo.pb.go gogo.pb.golden

+ 3 - 3
vendor/github.com/gogo/protobuf/gogoproto/doc.go

@@ -1,7 +1,7 @@
-// Extensions for Protocol Buffers to create more go like structures.
+// Protocol Buffers for Go with Gadgets
 //
 //
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // modification, are permitted provided that the following conditions are

+ 159 - 71
vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go

@@ -24,7 +24,9 @@ var _ = math.Inf
 
 
 // This is a compile-time assertion to ensure that this generated file
 // This is a compile-time assertion to ensure that this generated file
 // is compatible with the proto package it is being compiled against.
 // is compatible with the proto package it is being compiled against.
-const _ = proto.GoGoProtoPackageIsVersion1
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
 
 
 var E_GoprotoEnumPrefix = &proto.ExtensionDesc{
 var E_GoprotoEnumPrefix = &proto.ExtensionDesc{
 	ExtendedType:  (*google_protobuf.EnumOptions)(nil),
 	ExtendedType:  (*google_protobuf.EnumOptions)(nil),
@@ -32,6 +34,7 @@ var E_GoprotoEnumPrefix = &proto.ExtensionDesc{
 	Field:         62001,
 	Field:         62001,
 	Name:          "gogoproto.goproto_enum_prefix",
 	Name:          "gogoproto.goproto_enum_prefix",
 	Tag:           "varint,62001,opt,name=goproto_enum_prefix,json=goprotoEnumPrefix",
 	Tag:           "varint,62001,opt,name=goproto_enum_prefix,json=goprotoEnumPrefix",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_GoprotoEnumStringer = &proto.ExtensionDesc{
 var E_GoprotoEnumStringer = &proto.ExtensionDesc{
@@ -40,6 +43,7 @@ var E_GoprotoEnumStringer = &proto.ExtensionDesc{
 	Field:         62021,
 	Field:         62021,
 	Name:          "gogoproto.goproto_enum_stringer",
 	Name:          "gogoproto.goproto_enum_stringer",
 	Tag:           "varint,62021,opt,name=goproto_enum_stringer,json=goprotoEnumStringer",
 	Tag:           "varint,62021,opt,name=goproto_enum_stringer,json=goprotoEnumStringer",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_EnumStringer = &proto.ExtensionDesc{
 var E_EnumStringer = &proto.ExtensionDesc{
@@ -48,6 +52,7 @@ var E_EnumStringer = &proto.ExtensionDesc{
 	Field:         62022,
 	Field:         62022,
 	Name:          "gogoproto.enum_stringer",
 	Name:          "gogoproto.enum_stringer",
 	Tag:           "varint,62022,opt,name=enum_stringer,json=enumStringer",
 	Tag:           "varint,62022,opt,name=enum_stringer,json=enumStringer",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_EnumCustomname = &proto.ExtensionDesc{
 var E_EnumCustomname = &proto.ExtensionDesc{
@@ -56,6 +61,7 @@ var E_EnumCustomname = &proto.ExtensionDesc{
 	Field:         62023,
 	Field:         62023,
 	Name:          "gogoproto.enum_customname",
 	Name:          "gogoproto.enum_customname",
 	Tag:           "bytes,62023,opt,name=enum_customname,json=enumCustomname",
 	Tag:           "bytes,62023,opt,name=enum_customname,json=enumCustomname",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_EnumvalueCustomname = &proto.ExtensionDesc{
 var E_EnumvalueCustomname = &proto.ExtensionDesc{
@@ -64,6 +70,7 @@ var E_EnumvalueCustomname = &proto.ExtensionDesc{
 	Field:         66001,
 	Field:         66001,
 	Name:          "gogoproto.enumvalue_customname",
 	Name:          "gogoproto.enumvalue_customname",
 	Tag:           "bytes,66001,opt,name=enumvalue_customname,json=enumvalueCustomname",
 	Tag:           "bytes,66001,opt,name=enumvalue_customname,json=enumvalueCustomname",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_GoprotoGettersAll = &proto.ExtensionDesc{
 var E_GoprotoGettersAll = &proto.ExtensionDesc{
@@ -72,6 +79,7 @@ var E_GoprotoGettersAll = &proto.ExtensionDesc{
 	Field:         63001,
 	Field:         63001,
 	Name:          "gogoproto.goproto_getters_all",
 	Name:          "gogoproto.goproto_getters_all",
 	Tag:           "varint,63001,opt,name=goproto_getters_all,json=goprotoGettersAll",
 	Tag:           "varint,63001,opt,name=goproto_getters_all,json=goprotoGettersAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_GoprotoEnumPrefixAll = &proto.ExtensionDesc{
 var E_GoprotoEnumPrefixAll = &proto.ExtensionDesc{
@@ -80,6 +88,7 @@ var E_GoprotoEnumPrefixAll = &proto.ExtensionDesc{
 	Field:         63002,
 	Field:         63002,
 	Name:          "gogoproto.goproto_enum_prefix_all",
 	Name:          "gogoproto.goproto_enum_prefix_all",
 	Tag:           "varint,63002,opt,name=goproto_enum_prefix_all,json=goprotoEnumPrefixAll",
 	Tag:           "varint,63002,opt,name=goproto_enum_prefix_all,json=goprotoEnumPrefixAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_GoprotoStringerAll = &proto.ExtensionDesc{
 var E_GoprotoStringerAll = &proto.ExtensionDesc{
@@ -88,6 +97,7 @@ var E_GoprotoStringerAll = &proto.ExtensionDesc{
 	Field:         63003,
 	Field:         63003,
 	Name:          "gogoproto.goproto_stringer_all",
 	Name:          "gogoproto.goproto_stringer_all",
 	Tag:           "varint,63003,opt,name=goproto_stringer_all,json=goprotoStringerAll",
 	Tag:           "varint,63003,opt,name=goproto_stringer_all,json=goprotoStringerAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_VerboseEqualAll = &proto.ExtensionDesc{
 var E_VerboseEqualAll = &proto.ExtensionDesc{
@@ -96,6 +106,7 @@ var E_VerboseEqualAll = &proto.ExtensionDesc{
 	Field:         63004,
 	Field:         63004,
 	Name:          "gogoproto.verbose_equal_all",
 	Name:          "gogoproto.verbose_equal_all",
 	Tag:           "varint,63004,opt,name=verbose_equal_all,json=verboseEqualAll",
 	Tag:           "varint,63004,opt,name=verbose_equal_all,json=verboseEqualAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_FaceAll = &proto.ExtensionDesc{
 var E_FaceAll = &proto.ExtensionDesc{
@@ -104,6 +115,7 @@ var E_FaceAll = &proto.ExtensionDesc{
 	Field:         63005,
 	Field:         63005,
 	Name:          "gogoproto.face_all",
 	Name:          "gogoproto.face_all",
 	Tag:           "varint,63005,opt,name=face_all,json=faceAll",
 	Tag:           "varint,63005,opt,name=face_all,json=faceAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_GostringAll = &proto.ExtensionDesc{
 var E_GostringAll = &proto.ExtensionDesc{
@@ -112,6 +124,7 @@ var E_GostringAll = &proto.ExtensionDesc{
 	Field:         63006,
 	Field:         63006,
 	Name:          "gogoproto.gostring_all",
 	Name:          "gogoproto.gostring_all",
 	Tag:           "varint,63006,opt,name=gostring_all,json=gostringAll",
 	Tag:           "varint,63006,opt,name=gostring_all,json=gostringAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_PopulateAll = &proto.ExtensionDesc{
 var E_PopulateAll = &proto.ExtensionDesc{
@@ -120,6 +133,7 @@ var E_PopulateAll = &proto.ExtensionDesc{
 	Field:         63007,
 	Field:         63007,
 	Name:          "gogoproto.populate_all",
 	Name:          "gogoproto.populate_all",
 	Tag:           "varint,63007,opt,name=populate_all,json=populateAll",
 	Tag:           "varint,63007,opt,name=populate_all,json=populateAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_StringerAll = &proto.ExtensionDesc{
 var E_StringerAll = &proto.ExtensionDesc{
@@ -128,6 +142,7 @@ var E_StringerAll = &proto.ExtensionDesc{
 	Field:         63008,
 	Field:         63008,
 	Name:          "gogoproto.stringer_all",
 	Name:          "gogoproto.stringer_all",
 	Tag:           "varint,63008,opt,name=stringer_all,json=stringerAll",
 	Tag:           "varint,63008,opt,name=stringer_all,json=stringerAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_OnlyoneAll = &proto.ExtensionDesc{
 var E_OnlyoneAll = &proto.ExtensionDesc{
@@ -136,6 +151,7 @@ var E_OnlyoneAll = &proto.ExtensionDesc{
 	Field:         63009,
 	Field:         63009,
 	Name:          "gogoproto.onlyone_all",
 	Name:          "gogoproto.onlyone_all",
 	Tag:           "varint,63009,opt,name=onlyone_all,json=onlyoneAll",
 	Tag:           "varint,63009,opt,name=onlyone_all,json=onlyoneAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_EqualAll = &proto.ExtensionDesc{
 var E_EqualAll = &proto.ExtensionDesc{
@@ -144,6 +160,7 @@ var E_EqualAll = &proto.ExtensionDesc{
 	Field:         63013,
 	Field:         63013,
 	Name:          "gogoproto.equal_all",
 	Name:          "gogoproto.equal_all",
 	Tag:           "varint,63013,opt,name=equal_all,json=equalAll",
 	Tag:           "varint,63013,opt,name=equal_all,json=equalAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_DescriptionAll = &proto.ExtensionDesc{
 var E_DescriptionAll = &proto.ExtensionDesc{
@@ -152,6 +169,7 @@ var E_DescriptionAll = &proto.ExtensionDesc{
 	Field:         63014,
 	Field:         63014,
 	Name:          "gogoproto.description_all",
 	Name:          "gogoproto.description_all",
 	Tag:           "varint,63014,opt,name=description_all,json=descriptionAll",
 	Tag:           "varint,63014,opt,name=description_all,json=descriptionAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_TestgenAll = &proto.ExtensionDesc{
 var E_TestgenAll = &proto.ExtensionDesc{
@@ -160,6 +178,7 @@ var E_TestgenAll = &proto.ExtensionDesc{
 	Field:         63015,
 	Field:         63015,
 	Name:          "gogoproto.testgen_all",
 	Name:          "gogoproto.testgen_all",
 	Tag:           "varint,63015,opt,name=testgen_all,json=testgenAll",
 	Tag:           "varint,63015,opt,name=testgen_all,json=testgenAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_BenchgenAll = &proto.ExtensionDesc{
 var E_BenchgenAll = &proto.ExtensionDesc{
@@ -168,6 +187,7 @@ var E_BenchgenAll = &proto.ExtensionDesc{
 	Field:         63016,
 	Field:         63016,
 	Name:          "gogoproto.benchgen_all",
 	Name:          "gogoproto.benchgen_all",
 	Tag:           "varint,63016,opt,name=benchgen_all,json=benchgenAll",
 	Tag:           "varint,63016,opt,name=benchgen_all,json=benchgenAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_MarshalerAll = &proto.ExtensionDesc{
 var E_MarshalerAll = &proto.ExtensionDesc{
@@ -176,6 +196,7 @@ var E_MarshalerAll = &proto.ExtensionDesc{
 	Field:         63017,
 	Field:         63017,
 	Name:          "gogoproto.marshaler_all",
 	Name:          "gogoproto.marshaler_all",
 	Tag:           "varint,63017,opt,name=marshaler_all,json=marshalerAll",
 	Tag:           "varint,63017,opt,name=marshaler_all,json=marshalerAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_UnmarshalerAll = &proto.ExtensionDesc{
 var E_UnmarshalerAll = &proto.ExtensionDesc{
@@ -184,6 +205,7 @@ var E_UnmarshalerAll = &proto.ExtensionDesc{
 	Field:         63018,
 	Field:         63018,
 	Name:          "gogoproto.unmarshaler_all",
 	Name:          "gogoproto.unmarshaler_all",
 	Tag:           "varint,63018,opt,name=unmarshaler_all,json=unmarshalerAll",
 	Tag:           "varint,63018,opt,name=unmarshaler_all,json=unmarshalerAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_StableMarshalerAll = &proto.ExtensionDesc{
 var E_StableMarshalerAll = &proto.ExtensionDesc{
@@ -192,6 +214,7 @@ var E_StableMarshalerAll = &proto.ExtensionDesc{
 	Field:         63019,
 	Field:         63019,
 	Name:          "gogoproto.stable_marshaler_all",
 	Name:          "gogoproto.stable_marshaler_all",
 	Tag:           "varint,63019,opt,name=stable_marshaler_all,json=stableMarshalerAll",
 	Tag:           "varint,63019,opt,name=stable_marshaler_all,json=stableMarshalerAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_SizerAll = &proto.ExtensionDesc{
 var E_SizerAll = &proto.ExtensionDesc{
@@ -200,6 +223,7 @@ var E_SizerAll = &proto.ExtensionDesc{
 	Field:         63020,
 	Field:         63020,
 	Name:          "gogoproto.sizer_all",
 	Name:          "gogoproto.sizer_all",
 	Tag:           "varint,63020,opt,name=sizer_all,json=sizerAll",
 	Tag:           "varint,63020,opt,name=sizer_all,json=sizerAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_GoprotoEnumStringerAll = &proto.ExtensionDesc{
 var E_GoprotoEnumStringerAll = &proto.ExtensionDesc{
@@ -208,6 +232,7 @@ var E_GoprotoEnumStringerAll = &proto.ExtensionDesc{
 	Field:         63021,
 	Field:         63021,
 	Name:          "gogoproto.goproto_enum_stringer_all",
 	Name:          "gogoproto.goproto_enum_stringer_all",
 	Tag:           "varint,63021,opt,name=goproto_enum_stringer_all,json=goprotoEnumStringerAll",
 	Tag:           "varint,63021,opt,name=goproto_enum_stringer_all,json=goprotoEnumStringerAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_EnumStringerAll = &proto.ExtensionDesc{
 var E_EnumStringerAll = &proto.ExtensionDesc{
@@ -216,6 +241,7 @@ var E_EnumStringerAll = &proto.ExtensionDesc{
 	Field:         63022,
 	Field:         63022,
 	Name:          "gogoproto.enum_stringer_all",
 	Name:          "gogoproto.enum_stringer_all",
 	Tag:           "varint,63022,opt,name=enum_stringer_all,json=enumStringerAll",
 	Tag:           "varint,63022,opt,name=enum_stringer_all,json=enumStringerAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_UnsafeMarshalerAll = &proto.ExtensionDesc{
 var E_UnsafeMarshalerAll = &proto.ExtensionDesc{
@@ -224,6 +250,7 @@ var E_UnsafeMarshalerAll = &proto.ExtensionDesc{
 	Field:         63023,
 	Field:         63023,
 	Name:          "gogoproto.unsafe_marshaler_all",
 	Name:          "gogoproto.unsafe_marshaler_all",
 	Tag:           "varint,63023,opt,name=unsafe_marshaler_all,json=unsafeMarshalerAll",
 	Tag:           "varint,63023,opt,name=unsafe_marshaler_all,json=unsafeMarshalerAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_UnsafeUnmarshalerAll = &proto.ExtensionDesc{
 var E_UnsafeUnmarshalerAll = &proto.ExtensionDesc{
@@ -232,6 +259,7 @@ var E_UnsafeUnmarshalerAll = &proto.ExtensionDesc{
 	Field:         63024,
 	Field:         63024,
 	Name:          "gogoproto.unsafe_unmarshaler_all",
 	Name:          "gogoproto.unsafe_unmarshaler_all",
 	Tag:           "varint,63024,opt,name=unsafe_unmarshaler_all,json=unsafeUnmarshalerAll",
 	Tag:           "varint,63024,opt,name=unsafe_unmarshaler_all,json=unsafeUnmarshalerAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_GoprotoExtensionsMapAll = &proto.ExtensionDesc{
 var E_GoprotoExtensionsMapAll = &proto.ExtensionDesc{
@@ -240,6 +268,7 @@ var E_GoprotoExtensionsMapAll = &proto.ExtensionDesc{
 	Field:         63025,
 	Field:         63025,
 	Name:          "gogoproto.goproto_extensions_map_all",
 	Name:          "gogoproto.goproto_extensions_map_all",
 	Tag:           "varint,63025,opt,name=goproto_extensions_map_all,json=goprotoExtensionsMapAll",
 	Tag:           "varint,63025,opt,name=goproto_extensions_map_all,json=goprotoExtensionsMapAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_GoprotoUnrecognizedAll = &proto.ExtensionDesc{
 var E_GoprotoUnrecognizedAll = &proto.ExtensionDesc{
@@ -248,6 +277,7 @@ var E_GoprotoUnrecognizedAll = &proto.ExtensionDesc{
 	Field:         63026,
 	Field:         63026,
 	Name:          "gogoproto.goproto_unrecognized_all",
 	Name:          "gogoproto.goproto_unrecognized_all",
 	Tag:           "varint,63026,opt,name=goproto_unrecognized_all,json=goprotoUnrecognizedAll",
 	Tag:           "varint,63026,opt,name=goproto_unrecognized_all,json=goprotoUnrecognizedAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_GogoprotoImport = &proto.ExtensionDesc{
 var E_GogoprotoImport = &proto.ExtensionDesc{
@@ -256,6 +286,7 @@ var E_GogoprotoImport = &proto.ExtensionDesc{
 	Field:         63027,
 	Field:         63027,
 	Name:          "gogoproto.gogoproto_import",
 	Name:          "gogoproto.gogoproto_import",
 	Tag:           "varint,63027,opt,name=gogoproto_import,json=gogoprotoImport",
 	Tag:           "varint,63027,opt,name=gogoproto_import,json=gogoprotoImport",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_ProtosizerAll = &proto.ExtensionDesc{
 var E_ProtosizerAll = &proto.ExtensionDesc{
@@ -264,6 +295,7 @@ var E_ProtosizerAll = &proto.ExtensionDesc{
 	Field:         63028,
 	Field:         63028,
 	Name:          "gogoproto.protosizer_all",
 	Name:          "gogoproto.protosizer_all",
 	Tag:           "varint,63028,opt,name=protosizer_all,json=protosizerAll",
 	Tag:           "varint,63028,opt,name=protosizer_all,json=protosizerAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_CompareAll = &proto.ExtensionDesc{
 var E_CompareAll = &proto.ExtensionDesc{
@@ -272,6 +304,7 @@ var E_CompareAll = &proto.ExtensionDesc{
 	Field:         63029,
 	Field:         63029,
 	Name:          "gogoproto.compare_all",
 	Name:          "gogoproto.compare_all",
 	Tag:           "varint,63029,opt,name=compare_all,json=compareAll",
 	Tag:           "varint,63029,opt,name=compare_all,json=compareAll",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_GoprotoGetters = &proto.ExtensionDesc{
 var E_GoprotoGetters = &proto.ExtensionDesc{
@@ -280,6 +313,7 @@ var E_GoprotoGetters = &proto.ExtensionDesc{
 	Field:         64001,
 	Field:         64001,
 	Name:          "gogoproto.goproto_getters",
 	Name:          "gogoproto.goproto_getters",
 	Tag:           "varint,64001,opt,name=goproto_getters,json=goprotoGetters",
 	Tag:           "varint,64001,opt,name=goproto_getters,json=goprotoGetters",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_GoprotoStringer = &proto.ExtensionDesc{
 var E_GoprotoStringer = &proto.ExtensionDesc{
@@ -288,6 +322,7 @@ var E_GoprotoStringer = &proto.ExtensionDesc{
 	Field:         64003,
 	Field:         64003,
 	Name:          "gogoproto.goproto_stringer",
 	Name:          "gogoproto.goproto_stringer",
 	Tag:           "varint,64003,opt,name=goproto_stringer,json=goprotoStringer",
 	Tag:           "varint,64003,opt,name=goproto_stringer,json=goprotoStringer",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_VerboseEqual = &proto.ExtensionDesc{
 var E_VerboseEqual = &proto.ExtensionDesc{
@@ -296,6 +331,7 @@ var E_VerboseEqual = &proto.ExtensionDesc{
 	Field:         64004,
 	Field:         64004,
 	Name:          "gogoproto.verbose_equal",
 	Name:          "gogoproto.verbose_equal",
 	Tag:           "varint,64004,opt,name=verbose_equal,json=verboseEqual",
 	Tag:           "varint,64004,opt,name=verbose_equal,json=verboseEqual",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Face = &proto.ExtensionDesc{
 var E_Face = &proto.ExtensionDesc{
@@ -304,6 +340,7 @@ var E_Face = &proto.ExtensionDesc{
 	Field:         64005,
 	Field:         64005,
 	Name:          "gogoproto.face",
 	Name:          "gogoproto.face",
 	Tag:           "varint,64005,opt,name=face",
 	Tag:           "varint,64005,opt,name=face",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Gostring = &proto.ExtensionDesc{
 var E_Gostring = &proto.ExtensionDesc{
@@ -312,6 +349,7 @@ var E_Gostring = &proto.ExtensionDesc{
 	Field:         64006,
 	Field:         64006,
 	Name:          "gogoproto.gostring",
 	Name:          "gogoproto.gostring",
 	Tag:           "varint,64006,opt,name=gostring",
 	Tag:           "varint,64006,opt,name=gostring",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Populate = &proto.ExtensionDesc{
 var E_Populate = &proto.ExtensionDesc{
@@ -320,6 +358,7 @@ var E_Populate = &proto.ExtensionDesc{
 	Field:         64007,
 	Field:         64007,
 	Name:          "gogoproto.populate",
 	Name:          "gogoproto.populate",
 	Tag:           "varint,64007,opt,name=populate",
 	Tag:           "varint,64007,opt,name=populate",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Stringer = &proto.ExtensionDesc{
 var E_Stringer = &proto.ExtensionDesc{
@@ -328,6 +367,7 @@ var E_Stringer = &proto.ExtensionDesc{
 	Field:         67008,
 	Field:         67008,
 	Name:          "gogoproto.stringer",
 	Name:          "gogoproto.stringer",
 	Tag:           "varint,67008,opt,name=stringer",
 	Tag:           "varint,67008,opt,name=stringer",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Onlyone = &proto.ExtensionDesc{
 var E_Onlyone = &proto.ExtensionDesc{
@@ -336,6 +376,7 @@ var E_Onlyone = &proto.ExtensionDesc{
 	Field:         64009,
 	Field:         64009,
 	Name:          "gogoproto.onlyone",
 	Name:          "gogoproto.onlyone",
 	Tag:           "varint,64009,opt,name=onlyone",
 	Tag:           "varint,64009,opt,name=onlyone",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Equal = &proto.ExtensionDesc{
 var E_Equal = &proto.ExtensionDesc{
@@ -344,6 +385,7 @@ var E_Equal = &proto.ExtensionDesc{
 	Field:         64013,
 	Field:         64013,
 	Name:          "gogoproto.equal",
 	Name:          "gogoproto.equal",
 	Tag:           "varint,64013,opt,name=equal",
 	Tag:           "varint,64013,opt,name=equal",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Description = &proto.ExtensionDesc{
 var E_Description = &proto.ExtensionDesc{
@@ -352,6 +394,7 @@ var E_Description = &proto.ExtensionDesc{
 	Field:         64014,
 	Field:         64014,
 	Name:          "gogoproto.description",
 	Name:          "gogoproto.description",
 	Tag:           "varint,64014,opt,name=description",
 	Tag:           "varint,64014,opt,name=description",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Testgen = &proto.ExtensionDesc{
 var E_Testgen = &proto.ExtensionDesc{
@@ -360,6 +403,7 @@ var E_Testgen = &proto.ExtensionDesc{
 	Field:         64015,
 	Field:         64015,
 	Name:          "gogoproto.testgen",
 	Name:          "gogoproto.testgen",
 	Tag:           "varint,64015,opt,name=testgen",
 	Tag:           "varint,64015,opt,name=testgen",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Benchgen = &proto.ExtensionDesc{
 var E_Benchgen = &proto.ExtensionDesc{
@@ -368,6 +412,7 @@ var E_Benchgen = &proto.ExtensionDesc{
 	Field:         64016,
 	Field:         64016,
 	Name:          "gogoproto.benchgen",
 	Name:          "gogoproto.benchgen",
 	Tag:           "varint,64016,opt,name=benchgen",
 	Tag:           "varint,64016,opt,name=benchgen",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Marshaler = &proto.ExtensionDesc{
 var E_Marshaler = &proto.ExtensionDesc{
@@ -376,6 +421,7 @@ var E_Marshaler = &proto.ExtensionDesc{
 	Field:         64017,
 	Field:         64017,
 	Name:          "gogoproto.marshaler",
 	Name:          "gogoproto.marshaler",
 	Tag:           "varint,64017,opt,name=marshaler",
 	Tag:           "varint,64017,opt,name=marshaler",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Unmarshaler = &proto.ExtensionDesc{
 var E_Unmarshaler = &proto.ExtensionDesc{
@@ -384,6 +430,7 @@ var E_Unmarshaler = &proto.ExtensionDesc{
 	Field:         64018,
 	Field:         64018,
 	Name:          "gogoproto.unmarshaler",
 	Name:          "gogoproto.unmarshaler",
 	Tag:           "varint,64018,opt,name=unmarshaler",
 	Tag:           "varint,64018,opt,name=unmarshaler",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_StableMarshaler = &proto.ExtensionDesc{
 var E_StableMarshaler = &proto.ExtensionDesc{
@@ -392,6 +439,7 @@ var E_StableMarshaler = &proto.ExtensionDesc{
 	Field:         64019,
 	Field:         64019,
 	Name:          "gogoproto.stable_marshaler",
 	Name:          "gogoproto.stable_marshaler",
 	Tag:           "varint,64019,opt,name=stable_marshaler,json=stableMarshaler",
 	Tag:           "varint,64019,opt,name=stable_marshaler,json=stableMarshaler",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Sizer = &proto.ExtensionDesc{
 var E_Sizer = &proto.ExtensionDesc{
@@ -400,6 +448,7 @@ var E_Sizer = &proto.ExtensionDesc{
 	Field:         64020,
 	Field:         64020,
 	Name:          "gogoproto.sizer",
 	Name:          "gogoproto.sizer",
 	Tag:           "varint,64020,opt,name=sizer",
 	Tag:           "varint,64020,opt,name=sizer",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_UnsafeMarshaler = &proto.ExtensionDesc{
 var E_UnsafeMarshaler = &proto.ExtensionDesc{
@@ -408,6 +457,7 @@ var E_UnsafeMarshaler = &proto.ExtensionDesc{
 	Field:         64023,
 	Field:         64023,
 	Name:          "gogoproto.unsafe_marshaler",
 	Name:          "gogoproto.unsafe_marshaler",
 	Tag:           "varint,64023,opt,name=unsafe_marshaler,json=unsafeMarshaler",
 	Tag:           "varint,64023,opt,name=unsafe_marshaler,json=unsafeMarshaler",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_UnsafeUnmarshaler = &proto.ExtensionDesc{
 var E_UnsafeUnmarshaler = &proto.ExtensionDesc{
@@ -416,6 +466,7 @@ var E_UnsafeUnmarshaler = &proto.ExtensionDesc{
 	Field:         64024,
 	Field:         64024,
 	Name:          "gogoproto.unsafe_unmarshaler",
 	Name:          "gogoproto.unsafe_unmarshaler",
 	Tag:           "varint,64024,opt,name=unsafe_unmarshaler,json=unsafeUnmarshaler",
 	Tag:           "varint,64024,opt,name=unsafe_unmarshaler,json=unsafeUnmarshaler",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_GoprotoExtensionsMap = &proto.ExtensionDesc{
 var E_GoprotoExtensionsMap = &proto.ExtensionDesc{
@@ -424,6 +475,7 @@ var E_GoprotoExtensionsMap = &proto.ExtensionDesc{
 	Field:         64025,
 	Field:         64025,
 	Name:          "gogoproto.goproto_extensions_map",
 	Name:          "gogoproto.goproto_extensions_map",
 	Tag:           "varint,64025,opt,name=goproto_extensions_map,json=goprotoExtensionsMap",
 	Tag:           "varint,64025,opt,name=goproto_extensions_map,json=goprotoExtensionsMap",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_GoprotoUnrecognized = &proto.ExtensionDesc{
 var E_GoprotoUnrecognized = &proto.ExtensionDesc{
@@ -432,6 +484,7 @@ var E_GoprotoUnrecognized = &proto.ExtensionDesc{
 	Field:         64026,
 	Field:         64026,
 	Name:          "gogoproto.goproto_unrecognized",
 	Name:          "gogoproto.goproto_unrecognized",
 	Tag:           "varint,64026,opt,name=goproto_unrecognized,json=goprotoUnrecognized",
 	Tag:           "varint,64026,opt,name=goproto_unrecognized,json=goprotoUnrecognized",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Protosizer = &proto.ExtensionDesc{
 var E_Protosizer = &proto.ExtensionDesc{
@@ -440,6 +493,7 @@ var E_Protosizer = &proto.ExtensionDesc{
 	Field:         64028,
 	Field:         64028,
 	Name:          "gogoproto.protosizer",
 	Name:          "gogoproto.protosizer",
 	Tag:           "varint,64028,opt,name=protosizer",
 	Tag:           "varint,64028,opt,name=protosizer",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Compare = &proto.ExtensionDesc{
 var E_Compare = &proto.ExtensionDesc{
@@ -448,6 +502,7 @@ var E_Compare = &proto.ExtensionDesc{
 	Field:         64029,
 	Field:         64029,
 	Name:          "gogoproto.compare",
 	Name:          "gogoproto.compare",
 	Tag:           "varint,64029,opt,name=compare",
 	Tag:           "varint,64029,opt,name=compare",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Nullable = &proto.ExtensionDesc{
 var E_Nullable = &proto.ExtensionDesc{
@@ -456,6 +511,7 @@ var E_Nullable = &proto.ExtensionDesc{
 	Field:         65001,
 	Field:         65001,
 	Name:          "gogoproto.nullable",
 	Name:          "gogoproto.nullable",
 	Tag:           "varint,65001,opt,name=nullable",
 	Tag:           "varint,65001,opt,name=nullable",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Embed = &proto.ExtensionDesc{
 var E_Embed = &proto.ExtensionDesc{
@@ -464,6 +520,7 @@ var E_Embed = &proto.ExtensionDesc{
 	Field:         65002,
 	Field:         65002,
 	Name:          "gogoproto.embed",
 	Name:          "gogoproto.embed",
 	Tag:           "varint,65002,opt,name=embed",
 	Tag:           "varint,65002,opt,name=embed",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Customtype = &proto.ExtensionDesc{
 var E_Customtype = &proto.ExtensionDesc{
@@ -472,6 +529,7 @@ var E_Customtype = &proto.ExtensionDesc{
 	Field:         65003,
 	Field:         65003,
 	Name:          "gogoproto.customtype",
 	Name:          "gogoproto.customtype",
 	Tag:           "bytes,65003,opt,name=customtype",
 	Tag:           "bytes,65003,opt,name=customtype",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Customname = &proto.ExtensionDesc{
 var E_Customname = &proto.ExtensionDesc{
@@ -480,6 +538,7 @@ var E_Customname = &proto.ExtensionDesc{
 	Field:         65004,
 	Field:         65004,
 	Name:          "gogoproto.customname",
 	Name:          "gogoproto.customname",
 	Tag:           "bytes,65004,opt,name=customname",
 	Tag:           "bytes,65004,opt,name=customname",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Jsontag = &proto.ExtensionDesc{
 var E_Jsontag = &proto.ExtensionDesc{
@@ -488,6 +547,7 @@ var E_Jsontag = &proto.ExtensionDesc{
 	Field:         65005,
 	Field:         65005,
 	Name:          "gogoproto.jsontag",
 	Name:          "gogoproto.jsontag",
 	Tag:           "bytes,65005,opt,name=jsontag",
 	Tag:           "bytes,65005,opt,name=jsontag",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Moretags = &proto.ExtensionDesc{
 var E_Moretags = &proto.ExtensionDesc{
@@ -496,6 +556,7 @@ var E_Moretags = &proto.ExtensionDesc{
 	Field:         65006,
 	Field:         65006,
 	Name:          "gogoproto.moretags",
 	Name:          "gogoproto.moretags",
 	Tag:           "bytes,65006,opt,name=moretags",
 	Tag:           "bytes,65006,opt,name=moretags",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Casttype = &proto.ExtensionDesc{
 var E_Casttype = &proto.ExtensionDesc{
@@ -504,6 +565,7 @@ var E_Casttype = &proto.ExtensionDesc{
 	Field:         65007,
 	Field:         65007,
 	Name:          "gogoproto.casttype",
 	Name:          "gogoproto.casttype",
 	Tag:           "bytes,65007,opt,name=casttype",
 	Tag:           "bytes,65007,opt,name=casttype",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Castkey = &proto.ExtensionDesc{
 var E_Castkey = &proto.ExtensionDesc{
@@ -512,6 +574,7 @@ var E_Castkey = &proto.ExtensionDesc{
 	Field:         65008,
 	Field:         65008,
 	Name:          "gogoproto.castkey",
 	Name:          "gogoproto.castkey",
 	Tag:           "bytes,65008,opt,name=castkey",
 	Tag:           "bytes,65008,opt,name=castkey",
+	Filename:      "gogo.proto",
 }
 }
 
 
 var E_Castvalue = &proto.ExtensionDesc{
 var E_Castvalue = &proto.ExtensionDesc{
@@ -520,6 +583,25 @@ var E_Castvalue = &proto.ExtensionDesc{
 	Field:         65009,
 	Field:         65009,
 	Name:          "gogoproto.castvalue",
 	Name:          "gogoproto.castvalue",
 	Tag:           "bytes,65009,opt,name=castvalue",
 	Tag:           "bytes,65009,opt,name=castvalue",
+	Filename:      "gogo.proto",
+}
+
+var E_Stdtime = &proto.ExtensionDesc{
+	ExtendedType:  (*google_protobuf.FieldOptions)(nil),
+	ExtensionType: (*bool)(nil),
+	Field:         65010,
+	Name:          "gogoproto.stdtime",
+	Tag:           "varint,65010,opt,name=stdtime",
+	Filename:      "gogo.proto",
+}
+
+var E_Stdduration = &proto.ExtensionDesc{
+	ExtendedType:  (*google_protobuf.FieldOptions)(nil),
+	ExtensionType: (*bool)(nil),
+	Field:         65011,
+	Name:          "gogoproto.stdduration",
+	Tag:           "varint,65011,opt,name=stdduration",
+	Filename:      "gogo.proto",
 }
 }
 
 
 func init() {
 func init() {
@@ -585,77 +667,83 @@ func init() {
 	proto.RegisterExtension(E_Casttype)
 	proto.RegisterExtension(E_Casttype)
 	proto.RegisterExtension(E_Castkey)
 	proto.RegisterExtension(E_Castkey)
 	proto.RegisterExtension(E_Castvalue)
 	proto.RegisterExtension(E_Castvalue)
+	proto.RegisterExtension(E_Stdtime)
+	proto.RegisterExtension(E_Stdduration)
 }
 }
 
 
+func init() { proto.RegisterFile("gogo.proto", fileDescriptorGogo) }
+
 var fileDescriptorGogo = []byte{
 var fileDescriptorGogo = []byte{
-	// 1096 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x97, 0xcb, 0x6f, 0xdc, 0x54,
-	0x14, 0x87, 0x85, 0x48, 0x95, 0x99, 0x93, 0x17, 0x99, 0x84, 0x50, 0x2a, 0x10, 0xed, 0x8e, 0x55,
-	0xba, 0x42, 0xa8, 0xae, 0x10, 0x6a, 0xab, 0x34, 0x2a, 0x22, 0x10, 0x05, 0x52, 0x40, 0x2c, 0x46,
-	0x9e, 0xc9, 0x8d, 0x3b, 0xe0, 0xf1, 0x35, 0xbe, 0x76, 0xd5, 0xb0, 0x43, 0xe5, 0x21, 0x84, 0x78,
-	0x23, 0x41, 0x4b, 0xcb, 0x63, 0xc1, 0xfb, 0x59, 0x1e, 0x7b, 0x36, 0xc0, 0x9a, 0xff, 0x81, 0x0d,
-	0x10, 0x5e, 0x52, 0x76, 0xd9, 0xf4, 0x1e, 0xfb, 0x1c, 0xcf, 0xb5, 0x67, 0xa4, 0x7b, 0x67, 0xe7,
-	0x64, 0xee, 0xf7, 0xcd, 0xf5, 0x39, 0xbe, 0xe7, 0x37, 0x06, 0x08, 0x64, 0x20, 0x97, 0xe3, 0x44,
-	0xa6, 0xb2, 0xd5, 0xc4, 0xeb, 0xfc, 0xf2, 0xd0, 0xe1, 0x40, 0xca, 0x20, 0x14, 0x47, 0xf3, 0xbf,
-	0x3a, 0xd9, 0xf6, 0xd1, 0x2d, 0xa1, 0xba, 0x49, 0x2f, 0x4e, 0x65, 0x52, 0x2c, 0xf6, 0x1e, 0x80,
-	0x05, 0x5a, 0xdc, 0x16, 0x51, 0xd6, 0x6f, 0xc7, 0x89, 0xd8, 0xee, 0x5d, 0x68, 0xdd, 0xb6, 0x5c,
-	0x90, 0xcb, 0x4c, 0x2e, 0xaf, 0xe8, 0x4f, 0x1f, 0x8c, 0xd3, 0x9e, 0x8c, 0xd4, 0xc1, 0x6b, 0xbf,
-	0xdf, 0x78, 0xf8, 0x86, 0x3b, 0x1b, 0x1b, 0xf3, 0x84, 0xe2, 0x67, 0xeb, 0x39, 0xe8, 0x6d, 0xc0,
-	0xcd, 0x15, 0x9f, 0x4a, 0x93, 0x5e, 0x14, 0x88, 0xc4, 0x62, 0xfc, 0x99, 0x8c, 0x0b, 0x86, 0xf1,
-	0x21, 0x42, 0xbd, 0x53, 0x30, 0x33, 0x8e, 0xeb, 0x17, 0x72, 0x4d, 0x0b, 0x53, 0xb2, 0x0a, 0x73,
-	0xb9, 0xa4, 0x9b, 0xa9, 0x54, 0xf6, 0x23, 0xbf, 0x2f, 0x2c, 0x9a, 0x5f, 0x73, 0x4d, 0x73, 0x63,
-	0x16, 0xb1, 0x53, 0x25, 0xe5, 0x9d, 0x85, 0x45, 0xfc, 0xcf, 0x79, 0x3f, 0xcc, 0x84, 0x69, 0x3b,
-	0x32, 0xd2, 0x76, 0x16, 0x97, 0xb1, 0xf2, 0xb7, 0x8b, 0x13, 0xb9, 0x72, 0xa1, 0x14, 0x18, 0x5e,
-	0xa3, 0x13, 0x81, 0x48, 0x53, 0x91, 0xa8, 0xb6, 0x1f, 0x86, 0x23, 0x36, 0x79, 0xba, 0x17, 0x96,
-	0xc6, 0x4b, 0xbb, 0xd5, 0x4e, 0xac, 0x16, 0xe4, 0x89, 0x30, 0xf4, 0x36, 0xe1, 0x96, 0x11, 0x9d,
-	0x75, 0x70, 0x5e, 0x26, 0xe7, 0xe2, 0x50, 0x77, 0x51, 0xbb, 0x0e, 0xfc, 0xff, 0xb2, 0x1f, 0x0e,
-	0xce, 0x77, 0xc9, 0xd9, 0x22, 0x96, 0xdb, 0x82, 0xc6, 0xfb, 0x60, 0xfe, 0xbc, 0x48, 0x3a, 0x52,
-	0x89, 0xb6, 0x78, 0x2a, 0xf3, 0x43, 0x07, 0xdd, 0x15, 0xd2, 0xcd, 0x11, 0xb8, 0x82, 0x1c, 0xba,
-	0x8e, 0x41, 0x63, 0xdb, 0xef, 0x0a, 0x07, 0xc5, 0x55, 0x52, 0x4c, 0xe2, 0x7a, 0x44, 0x4f, 0xc0,
-	0x74, 0x20, 0x8b, 0x5b, 0x72, 0xc0, 0xdf, 0x23, 0x7c, 0x8a, 0x19, 0x52, 0xc4, 0x32, 0xce, 0x42,
-	0x3f, 0x75, 0xd9, 0xc1, 0xfb, 0xac, 0x60, 0x86, 0x14, 0x63, 0x94, 0xf5, 0x03, 0x56, 0x28, 0xa3,
-	0x9e, 0xf7, 0xc2, 0x94, 0x8c, 0xc2, 0x1d, 0x19, 0xb9, 0x6c, 0xe2, 0x43, 0x32, 0x00, 0x21, 0x28,
-	0x38, 0x0e, 0x4d, 0xd7, 0x46, 0x7c, 0x44, 0x78, 0x43, 0x70, 0x07, 0xf4, 0x39, 0xe3, 0x21, 0xa3,
-	0x57, 0x38, 0x28, 0x3e, 0x26, 0xc5, 0xac, 0x81, 0xd1, 0x6d, 0xa4, 0x42, 0xa5, 0x81, 0x70, 0x91,
-	0x7c, 0xc2, 0xb7, 0x41, 0x08, 0x95, 0xb2, 0x23, 0xa2, 0xee, 0x39, 0x37, 0xc3, 0xa7, 0x5c, 0x4a,
-	0x66, 0x50, 0xa1, 0x27, 0x4f, 0xdf, 0x4f, 0xd4, 0x39, 0x3f, 0x74, 0x6a, 0xc7, 0x67, 0xe4, 0x98,
-	0x2e, 0x21, 0xaa, 0x48, 0x16, 0x8d, 0xa3, 0xf9, 0x9c, 0x2b, 0x62, 0x60, 0x74, 0xf4, 0x54, 0xea,
-	0x77, 0x42, 0xd1, 0x1e, 0xc7, 0xf6, 0x05, 0x1f, 0xbd, 0x82, 0x5d, 0x33, 0x8d, 0xba, 0xd3, 0xaa,
-	0xf7, 0xb4, 0x93, 0xe6, 0x4b, 0xee, 0x74, 0x0e, 0x20, 0xfc, 0x18, 0xdc, 0x3a, 0x72, 0xd4, 0x3b,
-	0xc8, 0xbe, 0x22, 0xd9, 0xd2, 0x88, 0x71, 0x4f, 0x23, 0x61, 0x5c, 0xe5, 0xd7, 0x3c, 0x12, 0x44,
-	0xcd, 0xa5, 0xab, 0x96, 0x45, 0xca, 0xdf, 0x1e, 0xaf, 0x6a, 0xdf, 0x70, 0xd5, 0x0a, 0xb6, 0x52,
-	0xb5, 0x87, 0x61, 0x89, 0x8c, 0xe3, 0xf5, 0xf5, 0x5b, 0x1e, 0xac, 0x05, 0xbd, 0x59, 0xed, 0xee,
-	0xe3, 0x70, 0xa8, 0x2c, 0xe7, 0x85, 0x54, 0x44, 0x0a, 0x19, 0xbd, 0xe7, 0xd8, 0xc1, 0x7c, 0x8d,
-	0xcc, 0x3c, 0xf1, 0x57, 0x4a, 0xc1, 0x9a, 0x1f, 0xa3, 0xfc, 0x51, 0x38, 0xc8, 0xf2, 0x2c, 0x4a,
-	0x44, 0x57, 0x06, 0x91, 0x6e, 0xe3, 0x96, 0x83, 0xfa, 0xbb, 0x5a, 0xab, 0x36, 0x0d, 0x1c, 0xcd,
-	0x67, 0xe0, 0xa6, 0xf2, 0xf7, 0x46, 0xbb, 0xd7, 0x8f, 0x65, 0x92, 0x5a, 0x8c, 0xdf, 0x73, 0xa7,
-	0x4a, 0xee, 0x4c, 0x8e, 0x79, 0x2b, 0x30, 0x9b, 0xff, 0xe9, 0xfa, 0x48, 0xfe, 0x40, 0xa2, 0x99,
-	0x01, 0x45, 0x83, 0xa3, 0x2b, 0xfb, 0xb1, 0x9f, 0xb8, 0xcc, 0xbf, 0x1f, 0x79, 0x70, 0x10, 0x52,
-	0x3c, 0x7d, 0x73, 0xb5, 0x24, 0x6e, 0xdd, 0x31, 0x24, 0x59, 0x13, 0x4a, 0xf9, 0x41, 0xe9, 0x79,
-	0x66, 0x8f, 0xce, 0x6c, 0x35, 0x88, 0xbd, 0xfb, 0xb1, 0x3c, 0xd5, 0xb8, 0xb4, 0xcb, 0x2e, 0xee,
-	0x95, 0x15, 0xaa, 0xa4, 0xa5, 0x77, 0x1a, 0x66, 0x2a, 0x51, 0x69, 0x57, 0x3d, 0x4b, 0xaa, 0x69,
-	0x33, 0x29, 0xbd, 0xbb, 0x60, 0x02, 0x63, 0xcf, 0x8e, 0x3f, 0x47, 0x78, 0xbe, 0xdc, 0xbb, 0x07,
-	0x1a, 0x1c, 0x77, 0x76, 0xf4, 0x79, 0x42, 0x4b, 0x04, 0x71, 0x8e, 0x3a, 0x3b, 0xfe, 0x02, 0xe3,
-	0x8c, 0x20, 0xee, 0x5e, 0xc2, 0x9f, 0x5e, 0x9a, 0xa0, 0x71, 0xc5, 0xb5, 0x3b, 0x0e, 0x93, 0x94,
-	0x71, 0x76, 0xfa, 0x45, 0xfa, 0x72, 0x26, 0xbc, 0xbb, 0xe1, 0x80, 0x63, 0xc1, 0x5f, 0x26, 0xb4,
-	0x58, 0xaf, 0x13, 0x64, 0xca, 0xc8, 0x35, 0x3b, 0xfe, 0x0a, 0xe1, 0x26, 0x85, 0x5b, 0xa7, 0x5c,
-	0xb3, 0x0b, 0x5e, 0xe5, 0xad, 0x13, 0x81, 0x65, 0xe3, 0x48, 0xb3, 0xd3, 0xaf, 0x71, 0xd5, 0x19,
-	0xd1, 0xa7, 0xa9, 0x59, 0x8e, 0x29, 0x3b, 0xff, 0x3a, 0xf1, 0x03, 0x06, 0x2b, 0x60, 0x8c, 0x49,
-	0xbb, 0xe2, 0x0d, 0xae, 0x80, 0x41, 0xe1, 0x31, 0xaa, 0x47, 0x9f, 0xdd, 0xf4, 0x26, 0x1f, 0xa3,
-	0x5a, 0xf2, 0x61, 0x37, 0xf3, 0x69, 0x61, 0x57, 0xbc, 0xc5, 0xdd, 0xcc, 0xd7, 0xe3, 0x36, 0xea,
-	0x59, 0x62, 0x77, 0xbc, 0xcd, 0xdb, 0xa8, 0x45, 0x89, 0x4e, 0xa6, 0xd6, 0x70, 0x8e, 0xd8, 0x7d,
-	0xef, 0x90, 0x6f, 0x7e, 0x28, 0x46, 0xbc, 0x47, 0x60, 0x69, 0x74, 0x86, 0xd8, 0xad, 0x97, 0xf6,
-	0x6a, 0xbf, 0xfa, 0xcd, 0x08, 0xd1, 0x91, 0xb7, 0x38, 0x2a, 0x3f, 0xec, 0xda, 0xcb, 0x7b, 0xd5,
-	0x17, 0x3b, 0x33, 0x3e, 0xf4, 0x2f, 0x34, 0x18, 0x8c, 0x6e, 0xbb, 0xeb, 0x0a, 0xb9, 0x0c, 0x08,
-	0x8f, 0x06, 0x4d, 0x6e, 0x3b, 0x7f, 0x95, 0x8f, 0x06, 0x11, 0x1a, 0x6e, 0x44, 0x59, 0x18, 0xe2,
-	0xc3, 0xd1, 0xba, 0x7d, 0x44, 0x4c, 0x88, 0x70, 0x8b, 0xd9, 0x3f, 0xf6, 0xe9, 0x60, 0x30, 0xa0,
-	0x67, 0xe8, 0x01, 0xd1, 0xef, 0xe8, 0x1a, 0x58, 0xc8, 0x3f, 0xf7, 0x79, 0x20, 0xe0, 0x6a, 0x7d,
-	0x9e, 0xa0, 0x78, 0x69, 0x4c, 0x77, 0x62, 0xeb, 0xb7, 0xfe, 0xb5, 0x5f, 0xbc, 0x83, 0x1a, 0xc8,
-	0x40, 0x90, 0xbf, 0x75, 0x5a, 0x04, 0xbb, 0x55, 0x41, 0xfe, 0xa2, 0x79, 0x0c, 0x26, 0x9f, 0x50,
-	0x32, 0x4a, 0xfd, 0xc0, 0x46, 0xff, 0x4d, 0x34, 0xaf, 0xc7, 0x82, 0xf5, 0x65, 0x22, 0xf4, 0xa5,
-	0xb2, 0xb1, 0xff, 0x10, 0x5b, 0x02, 0x08, 0x77, 0x7d, 0x95, 0xba, 0xdc, 0xf7, 0xbf, 0x0c, 0x33,
-	0x80, 0x9b, 0xc6, 0xeb, 0x27, 0xc5, 0x8e, 0x8d, 0xfd, 0x8f, 0x37, 0x4d, 0xeb, 0xf5, 0x00, 0x6c,
-	0xe2, 0x65, 0xfe, 0xbe, 0x6d, 0x83, 0xff, 0x27, 0x78, 0x40, 0x9c, 0x3c, 0x02, 0x0b, 0xfa, 0x79,
-	0xa9, 0x63, 0x27, 0x61, 0x55, 0xae, 0xca, 0xf5, 0xfc, 0x41, 0xbc, 0x1e, 0x00, 0x00, 0xff, 0xff,
-	0x87, 0x5c, 0xee, 0x2b, 0x7e, 0x11, 0x00, 0x00,
+	// 1129 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x97, 0xc9, 0x6f, 0x1c, 0x45,
+	0x14, 0x87, 0x85, 0x70, 0x64, 0xcf, 0xf3, 0x86, 0xc7, 0xc6, 0x84, 0x08, 0x44, 0x72, 0xe3, 0xe4,
+	0x9c, 0x22, 0x94, 0xb2, 0x22, 0xcb, 0xb1, 0x9c, 0x51, 0x10, 0x86, 0x91, 0x89, 0x03, 0x88, 0xc3,
+	0xa8, 0x67, 0xa6, 0xdc, 0x69, 0xe8, 0xee, 0x6a, 0xba, 0xaa, 0xa3, 0x38, 0x37, 0x14, 0x16, 0x21,
+	0xc4, 0x8e, 0x04, 0x09, 0x09, 0xcb, 0x81, 0x7d, 0x0d, 0xcb, 0x9d, 0x0b, 0x70, 0xe6, 0x7f, 0xe0,
+	0x02, 0x84, 0xdd, 0x37, 0x5f, 0x50, 0x75, 0xbf, 0xd7, 0x53, 0xdd, 0x1e, 0xa9, 0x6a, 0x6e, 0xe3,
+	0x71, 0x7d, 0xdf, 0x54, 0xbf, 0x37, 0xf5, 0x7e, 0x53, 0x00, 0xbe, 0xf0, 0xc5, 0x52, 0x92, 0x0a,
+	0x25, 0x9a, 0x0d, 0xfd, 0x3a, 0x7f, 0x79, 0xe8, 0xb0, 0x2f, 0x84, 0x1f, 0xf2, 0xa3, 0xf9, 0x5f,
+	0xdd, 0x6c, 0xfb, 0x68, 0x9f, 0xcb, 0x5e, 0x1a, 0x24, 0x4a, 0xa4, 0xc5, 0x62, 0x76, 0x3f, 0xcc,
+	0xe3, 0xe2, 0x0e, 0x8f, 0xb3, 0xa8, 0x93, 0xa4, 0x7c, 0x3b, 0xb8, 0xd0, 0xbc, 0x63, 0xa9, 0x20,
+	0x97, 0x88, 0x5c, 0x5a, 0x8f, 0xb3, 0xe8, 0x81, 0x44, 0x05, 0x22, 0x96, 0x07, 0xaf, 0xff, 0x72,
+	0xf3, 0xe1, 0x9b, 0xee, 0x9e, 0xd8, 0x9c, 0x43, 0x54, 0xff, 0xaf, 0x9d, 0x83, 0x6c, 0x13, 0x6e,
+	0xad, 0xf8, 0xa4, 0x4a, 0x83, 0xd8, 0xe7, 0xa9, 0xc5, 0xf8, 0x03, 0x1a, 0xe7, 0x0d, 0xe3, 0x83,
+	0x88, 0xb2, 0x35, 0x98, 0x1e, 0xc5, 0xf5, 0x23, 0xba, 0xa6, 0xb8, 0x29, 0x69, 0xc1, 0x6c, 0x2e,
+	0xe9, 0x65, 0x52, 0x89, 0x28, 0xf6, 0x22, 0x6e, 0xd1, 0xfc, 0x94, 0x6b, 0x1a, 0x9b, 0x33, 0x1a,
+	0x5b, 0x2b, 0x29, 0x76, 0x16, 0x16, 0xf4, 0x3b, 0xe7, 0xbd, 0x30, 0xe3, 0xa6, 0xed, 0xc8, 0x50,
+	0xdb, 0x59, 0xbd, 0x8c, 0x94, 0x3f, 0x5f, 0x1a, 0xcb, 0x95, 0xf3, 0xa5, 0xc0, 0xf0, 0x1a, 0x9d,
+	0xf0, 0xb9, 0x52, 0x3c, 0x95, 0x1d, 0x2f, 0x0c, 0x87, 0x6c, 0xf2, 0x54, 0x10, 0x96, 0xc6, 0xcb,
+	0x37, 0xaa, 0x9d, 0x68, 0x15, 0xe4, 0x6a, 0x18, 0xb2, 0x2d, 0xb8, 0x6d, 0x48, 0x67, 0x1d, 0x9c,
+	0x57, 0xd0, 0xb9, 0xb0, 0xaf, 0xbb, 0x5a, 0xdb, 0x06, 0x7a, 0xbf, 0xec, 0x87, 0x83, 0xf3, 0x2d,
+	0x74, 0x36, 0x91, 0xa5, 0xb6, 0x68, 0xe3, 0xbd, 0x30, 0x77, 0x9e, 0xa7, 0x5d, 0x21, 0x79, 0x87,
+	0x3f, 0x91, 0x79, 0xa1, 0x83, 0xee, 0x2a, 0xea, 0x66, 0x11, 0x5c, 0xd7, 0x9c, 0x76, 0x1d, 0x87,
+	0x89, 0x6d, 0xaf, 0xc7, 0x1d, 0x14, 0xd7, 0x50, 0x31, 0xae, 0xd7, 0x6b, 0x74, 0x15, 0xa6, 0x7c,
+	0x51, 0x3c, 0x92, 0x03, 0xfe, 0x36, 0xe2, 0x93, 0xc4, 0xa0, 0x22, 0x11, 0x49, 0x16, 0x7a, 0xca,
+	0x65, 0x07, 0xef, 0x90, 0x82, 0x18, 0x54, 0x8c, 0x50, 0xd6, 0x77, 0x49, 0x21, 0x8d, 0x7a, 0xae,
+	0xc0, 0xa4, 0x88, 0xc3, 0x1d, 0x11, 0xbb, 0x6c, 0xe2, 0x3d, 0x34, 0x00, 0x22, 0x5a, 0xb0, 0x0c,
+	0x0d, 0xd7, 0x46, 0xbc, 0x8f, 0xf8, 0x04, 0xa7, 0x0e, 0xb4, 0x60, 0x96, 0x86, 0x4c, 0x20, 0x62,
+	0x07, 0xc5, 0x07, 0xa8, 0x98, 0x31, 0x30, 0x7c, 0x0c, 0xc5, 0xa5, 0xf2, 0xb9, 0x8b, 0xe4, 0x43,
+	0x7a, 0x0c, 0x44, 0xb0, 0x94, 0x5d, 0x1e, 0xf7, 0xce, 0xb9, 0x19, 0x3e, 0xa2, 0x52, 0x12, 0xa3,
+	0x15, 0x6b, 0x30, 0x1d, 0x79, 0xa9, 0x3c, 0xe7, 0x85, 0x4e, 0xed, 0xf8, 0x18, 0x1d, 0x53, 0x25,
+	0x84, 0x15, 0xc9, 0xe2, 0x51, 0x34, 0x9f, 0x50, 0x45, 0x0c, 0x0c, 0x8f, 0x9e, 0x54, 0x5e, 0x37,
+	0xe4, 0x9d, 0x51, 0x6c, 0x9f, 0xd2, 0xd1, 0x2b, 0xd8, 0x0d, 0xd3, 0xb8, 0x0c, 0x0d, 0x19, 0x5c,
+	0x74, 0xd2, 0x7c, 0x46, 0x9d, 0xce, 0x01, 0x0d, 0x3f, 0x02, 0xb7, 0x0f, 0x1d, 0xf5, 0x0e, 0xb2,
+	0xcf, 0x51, 0xb6, 0x38, 0x64, 0xdc, 0xe3, 0x48, 0x18, 0x55, 0xf9, 0x05, 0x8d, 0x04, 0x5e, 0x73,
+	0xb5, 0x61, 0x21, 0x8b, 0xa5, 0xb7, 0x3d, 0x5a, 0xd5, 0xbe, 0xa4, 0xaa, 0x15, 0x6c, 0xa5, 0x6a,
+	0x67, 0x60, 0x11, 0x8d, 0xa3, 0xf5, 0xf5, 0x2b, 0x1a, 0xac, 0x05, 0xbd, 0x55, 0xed, 0xee, 0xa3,
+	0x70, 0xa8, 0x2c, 0xe7, 0x05, 0xc5, 0x63, 0xa9, 0x99, 0x4e, 0xe4, 0x25, 0x0e, 0xe6, 0xeb, 0x68,
+	0xa6, 0x89, 0xbf, 0x5e, 0x0a, 0x36, 0xbc, 0x44, 0xcb, 0x1f, 0x86, 0x83, 0x24, 0xcf, 0xe2, 0x94,
+	0xf7, 0x84, 0x1f, 0x07, 0x17, 0x79, 0xdf, 0x41, 0xfd, 0x75, 0xad, 0x55, 0x5b, 0x06, 0xae, 0xcd,
+	0xa7, 0xe1, 0x96, 0xf2, 0xf7, 0x46, 0x27, 0x88, 0x12, 0x91, 0x2a, 0x8b, 0xf1, 0x1b, 0xea, 0x54,
+	0xc9, 0x9d, 0xce, 0x31, 0xb6, 0x0e, 0x33, 0xf9, 0x9f, 0xae, 0x5f, 0xc9, 0x6f, 0x51, 0x34, 0x3d,
+	0xa0, 0x70, 0x70, 0xf4, 0x44, 0x94, 0x78, 0xa9, 0xcb, 0xfc, 0xfb, 0x8e, 0x06, 0x07, 0x22, 0xc5,
+	0xb7, 0x6f, 0xb6, 0x96, 0xc4, 0xcd, 0xbb, 0xf6, 0x49, 0x36, 0xb8, 0x94, 0x9e, 0x5f, 0x7a, 0x9e,
+	0xdc, 0xc5, 0x33, 0x5b, 0x0d, 0x62, 0x76, 0x9f, 0x2e, 0x4f, 0x35, 0x2e, 0xed, 0xb2, 0x4b, 0xbb,
+	0x65, 0x85, 0x2a, 0x69, 0xc9, 0x4e, 0xc1, 0x74, 0x25, 0x2a, 0xed, 0xaa, 0xa7, 0x50, 0x35, 0x65,
+	0x26, 0x25, 0x3b, 0x06, 0x63, 0x3a, 0xf6, 0xec, 0xf8, 0xd3, 0x88, 0xe7, 0xcb, 0xd9, 0x09, 0x98,
+	0xa0, 0xb8, 0xb3, 0xa3, 0xcf, 0x20, 0x5a, 0x22, 0x1a, 0xa7, 0xa8, 0xb3, 0xe3, 0xcf, 0x12, 0x4e,
+	0x88, 0xc6, 0xdd, 0x4b, 0xf8, 0xfd, 0xf3, 0x63, 0x38, 0xae, 0xa8, 0x76, 0xcb, 0x30, 0x8e, 0x19,
+	0x67, 0xa7, 0x9f, 0xc3, 0x0f, 0x27, 0x82, 0xdd, 0x03, 0x07, 0x1c, 0x0b, 0xfe, 0x02, 0xa2, 0xc5,
+	0x7a, 0xb6, 0x06, 0x93, 0x46, 0xae, 0xd9, 0xf1, 0x17, 0x11, 0x37, 0x29, 0xbd, 0x75, 0xcc, 0x35,
+	0xbb, 0xe0, 0x25, 0xda, 0x3a, 0x12, 0xba, 0x6c, 0x14, 0x69, 0x76, 0xfa, 0x65, 0xaa, 0x3a, 0x21,
+	0x6c, 0x05, 0x1a, 0xe5, 0x98, 0xb2, 0xf3, 0xaf, 0x20, 0x3f, 0x60, 0x74, 0x05, 0x8c, 0x31, 0x69,
+	0x57, 0xbc, 0x4a, 0x15, 0x30, 0x28, 0x7d, 0x8c, 0xea, 0xd1, 0x67, 0x37, 0xbd, 0x46, 0xc7, 0xa8,
+	0x96, 0x7c, 0xba, 0x9b, 0xf9, 0xb4, 0xb0, 0x2b, 0x5e, 0xa7, 0x6e, 0xe6, 0xeb, 0xf5, 0x36, 0xea,
+	0x59, 0x62, 0x77, 0xbc, 0x41, 0xdb, 0xa8, 0x45, 0x09, 0x6b, 0x43, 0x73, 0x7f, 0x8e, 0xd8, 0x7d,
+	0x6f, 0xa2, 0x6f, 0x6e, 0x5f, 0x8c, 0xb0, 0x87, 0x60, 0x71, 0x78, 0x86, 0xd8, 0xad, 0x97, 0x77,
+	0x6b, 0xbf, 0xfa, 0xcd, 0x08, 0x61, 0x67, 0x06, 0xbf, 0xfa, 0xcd, 0xfc, 0xb0, 0x6b, 0xaf, 0xec,
+	0x56, 0x2f, 0x76, 0x66, 0x7c, 0xb0, 0x55, 0x80, 0xc1, 0xe8, 0xb6, 0xbb, 0xae, 0xa2, 0xcb, 0x80,
+	0xf4, 0xd1, 0xc0, 0xc9, 0x6d, 0xe7, 0xaf, 0xd1, 0xd1, 0x40, 0x82, 0x2d, 0xc3, 0x44, 0x9c, 0x85,
+	0xa1, 0xfe, 0x72, 0x34, 0xef, 0x1c, 0x12, 0x13, 0x3c, 0xec, 0x13, 0xfb, 0xeb, 0x1e, 0x1e, 0x0c,
+	0x02, 0xd8, 0x31, 0x38, 0xc0, 0xa3, 0x2e, 0xef, 0xdb, 0xc8, 0xdf, 0xf6, 0x68, 0x20, 0xe8, 0xd5,
+	0x6c, 0x05, 0xa0, 0xb8, 0x34, 0xaa, 0x9d, 0xc4, 0xfa, 0xa9, 0xbf, 0xef, 0x15, 0x77, 0x50, 0x03,
+	0x19, 0x08, 0xf2, 0x5b, 0xa7, 0x45, 0x70, 0xa3, 0x2a, 0xc8, 0x2f, 0x9a, 0xc7, 0x61, 0xfc, 0x31,
+	0x29, 0x62, 0xe5, 0xf9, 0x36, 0xfa, 0x0f, 0xa4, 0x69, 0xbd, 0x2e, 0x58, 0x24, 0x52, 0xae, 0x3c,
+	0x5f, 0xda, 0xd8, 0x3f, 0x91, 0x2d, 0x01, 0x0d, 0xf7, 0x3c, 0xa9, 0x5c, 0x9e, 0xfb, 0x2f, 0x82,
+	0x09, 0xd0, 0x9b, 0xd6, 0xaf, 0x1f, 0xe7, 0x3b, 0x36, 0xf6, 0x6f, 0xda, 0x34, 0xae, 0x67, 0x27,
+	0xa0, 0xa1, 0x5f, 0xe6, 0xf7, 0x6d, 0x1b, 0xfc, 0x0f, 0xc2, 0x03, 0x42, 0x7f, 0xb2, 0x54, 0x7d,
+	0x15, 0xd8, 0x8b, 0xfd, 0x2f, 0x76, 0x9a, 0xd6, 0xb3, 0x55, 0x98, 0x94, 0xaa, 0xdf, 0xcf, 0x52,
+	0x2f, 0x1f, 0xfe, 0x16, 0xfc, 0xbf, 0xbd, 0xf2, 0x32, 0x57, 0x32, 0x27, 0x8f, 0xc0, 0x7c, 0x4f,
+	0x44, 0x75, 0xf0, 0x24, 0xb4, 0x44, 0x4b, 0xb4, 0xf3, 0x63, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0xff,
+	0xff, 0x3f, 0x9b, 0x2b, 0x54, 0xfc, 0x11, 0x00, 0x00,
 }
 }

+ 45 - 0
vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden

@@ -0,0 +1,45 @@
+// Code generated by protoc-gen-go.
+// source: gogo.proto
+// DO NOT EDIT!
+
+package gogoproto
+
+import proto "github.com/gogo/protobuf/proto"
+import json "encoding/json"
+import math "math"
+import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor"
+
+// Reference proto, json, and math imports to suppress error if they are not otherwise used.
+var _ = proto.Marshal
+var _ = &json.SyntaxError{}
+var _ = math.Inf
+
+var E_Nullable = &proto.ExtensionDesc{
+	ExtendedType:  (*google_protobuf.FieldOptions)(nil),
+	ExtensionType: (*bool)(nil),
+	Field:         51235,
+	Name:          "gogoproto.nullable",
+	Tag:           "varint,51235,opt,name=nullable",
+}
+
+var E_Embed = &proto.ExtensionDesc{
+	ExtendedType:  (*google_protobuf.FieldOptions)(nil),
+	ExtensionType: (*bool)(nil),
+	Field:         51236,
+	Name:          "gogoproto.embed",
+	Tag:           "varint,51236,opt,name=embed",
+}
+
+var E_Customtype = &proto.ExtensionDesc{
+	ExtendedType:  (*google_protobuf.FieldOptions)(nil),
+	ExtensionType: (*string)(nil),
+	Field:         51237,
+	Name:          "gogoproto.customtype",
+	Tag:           "bytes,51237,opt,name=customtype",
+}
+
+func init() {
+	proto.RegisterExtension(E_Nullable)
+	proto.RegisterExtension(E_Embed)
+	proto.RegisterExtension(E_Customtype)
+}

+ 125 - 0
vendor/github.com/gogo/protobuf/gogoproto/gogo.proto

@@ -0,0 +1,125 @@
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto2";
+package gogoproto;
+
+import "google/protobuf/descriptor.proto";
+
+option java_package = "com.google.protobuf";
+option java_outer_classname = "GoGoProtos";
+
+extend google.protobuf.EnumOptions {
+	optional bool goproto_enum_prefix = 62001;
+	optional bool goproto_enum_stringer = 62021;
+	optional bool enum_stringer = 62022;
+	optional string enum_customname = 62023;
+}
+
+extend google.protobuf.EnumValueOptions {
+	optional string enumvalue_customname = 66001;
+}
+
+extend google.protobuf.FileOptions {
+	optional bool goproto_getters_all = 63001;
+	optional bool goproto_enum_prefix_all = 63002;
+	optional bool goproto_stringer_all = 63003;
+	optional bool verbose_equal_all = 63004;
+	optional bool face_all = 63005;
+	optional bool gostring_all = 63006;
+	optional bool populate_all = 63007;
+	optional bool stringer_all = 63008;
+	optional bool onlyone_all = 63009;
+
+	optional bool equal_all = 63013;
+	optional bool description_all = 63014;
+	optional bool testgen_all = 63015;
+	optional bool benchgen_all = 63016;
+	optional bool marshaler_all = 63017;
+	optional bool unmarshaler_all = 63018;
+	optional bool stable_marshaler_all = 63019;
+
+	optional bool sizer_all = 63020;
+
+	optional bool goproto_enum_stringer_all = 63021;
+	optional bool enum_stringer_all = 63022;
+
+	optional bool unsafe_marshaler_all = 63023;
+	optional bool unsafe_unmarshaler_all = 63024;
+
+	optional bool goproto_extensions_map_all = 63025;
+	optional bool goproto_unrecognized_all = 63026;
+	optional bool gogoproto_import = 63027;
+	optional bool protosizer_all = 63028;
+	optional bool compare_all = 63029;
+}
+
+extend google.protobuf.MessageOptions {
+	optional bool goproto_getters = 64001;
+	optional bool goproto_stringer = 64003;
+	optional bool verbose_equal = 64004;
+	optional bool face = 64005;
+	optional bool gostring = 64006;
+	optional bool populate = 64007;
+	optional bool stringer = 67008;
+	optional bool onlyone = 64009;
+
+	optional bool equal = 64013;
+	optional bool description = 64014;
+	optional bool testgen = 64015;
+	optional bool benchgen = 64016;
+	optional bool marshaler = 64017;
+	optional bool unmarshaler = 64018;
+	optional bool stable_marshaler = 64019;
+
+	optional bool sizer = 64020;
+
+	optional bool unsafe_marshaler = 64023;
+	optional bool unsafe_unmarshaler = 64024;
+
+	optional bool goproto_extensions_map = 64025;
+	optional bool goproto_unrecognized = 64026;
+
+	optional bool protosizer = 64028;
+	optional bool compare = 64029;
+}
+
+extend google.protobuf.FieldOptions {
+	optional bool nullable = 65001;
+	optional bool embed = 65002;
+	optional string customtype = 65003;
+	optional string customname = 65004;
+	optional string jsontag = 65005;
+	optional string moretags = 65006;
+	optional string casttype = 65007;
+	optional string castkey = 65008;
+	optional string castvalue = 65009;
+
+	optional bool stdtime = 65010;
+	optional bool stdduration = 65011;
+}

+ 38 - 1
vendor/github.com/gogo/protobuf/gogoproto/helper.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
@@ -37,6 +39,14 @@ func IsNullable(field *google_protobuf.FieldDescriptorProto) bool {
 	return proto.GetBoolExtension(field.Options, E_Nullable, true)
 	return proto.GetBoolExtension(field.Options, E_Nullable, true)
 }
 }
 
 
+func IsStdTime(field *google_protobuf.FieldDescriptorProto) bool {
+	return proto.GetBoolExtension(field.Options, E_Stdtime, false)
+}
+
+func IsStdDuration(field *google_protobuf.FieldDescriptorProto) bool {
+	return proto.GetBoolExtension(field.Options, E_Stdduration, false)
+}
+
 func NeedsNilCheck(proto3 bool, field *google_protobuf.FieldDescriptorProto) bool {
 func NeedsNilCheck(proto3 bool, field *google_protobuf.FieldDescriptorProto) bool {
 	nullable := IsNullable(field)
 	nullable := IsNullable(field)
 	if field.IsMessage() || IsCustomType(field) {
 	if field.IsMessage() || IsCustomType(field) {
@@ -81,6 +91,9 @@ func IsCastValue(field *google_protobuf.FieldDescriptorProto) bool {
 }
 }
 
 
 func GetCustomType(field *google_protobuf.FieldDescriptorProto) string {
 func GetCustomType(field *google_protobuf.FieldDescriptorProto) string {
+	if field == nil {
+		return ""
+	}
 	if field.Options != nil {
 	if field.Options != nil {
 		v, err := proto.GetExtension(field.Options, E_Customtype)
 		v, err := proto.GetExtension(field.Options, E_Customtype)
 		if err == nil && v.(*string) != nil {
 		if err == nil && v.(*string) != nil {
@@ -91,6 +104,9 @@ func GetCustomType(field *google_protobuf.FieldDescriptorProto) string {
 }
 }
 
 
 func GetCastType(field *google_protobuf.FieldDescriptorProto) string {
 func GetCastType(field *google_protobuf.FieldDescriptorProto) string {
+	if field == nil {
+		return ""
+	}
 	if field.Options != nil {
 	if field.Options != nil {
 		v, err := proto.GetExtension(field.Options, E_Casttype)
 		v, err := proto.GetExtension(field.Options, E_Casttype)
 		if err == nil && v.(*string) != nil {
 		if err == nil && v.(*string) != nil {
@@ -101,6 +117,9 @@ func GetCastType(field *google_protobuf.FieldDescriptorProto) string {
 }
 }
 
 
 func GetCastKey(field *google_protobuf.FieldDescriptorProto) string {
 func GetCastKey(field *google_protobuf.FieldDescriptorProto) string {
+	if field == nil {
+		return ""
+	}
 	if field.Options != nil {
 	if field.Options != nil {
 		v, err := proto.GetExtension(field.Options, E_Castkey)
 		v, err := proto.GetExtension(field.Options, E_Castkey)
 		if err == nil && v.(*string) != nil {
 		if err == nil && v.(*string) != nil {
@@ -111,6 +130,9 @@ func GetCastKey(field *google_protobuf.FieldDescriptorProto) string {
 }
 }
 
 
 func GetCastValue(field *google_protobuf.FieldDescriptorProto) string {
 func GetCastValue(field *google_protobuf.FieldDescriptorProto) string {
+	if field == nil {
+		return ""
+	}
 	if field.Options != nil {
 	if field.Options != nil {
 		v, err := proto.GetExtension(field.Options, E_Castvalue)
 		v, err := proto.GetExtension(field.Options, E_Castvalue)
 		if err == nil && v.(*string) != nil {
 		if err == nil && v.(*string) != nil {
@@ -145,6 +167,9 @@ func IsEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) bool
 }
 }
 
 
 func GetCustomName(field *google_protobuf.FieldDescriptorProto) string {
 func GetCustomName(field *google_protobuf.FieldDescriptorProto) string {
+	if field == nil {
+		return ""
+	}
 	if field.Options != nil {
 	if field.Options != nil {
 		v, err := proto.GetExtension(field.Options, E_Customname)
 		v, err := proto.GetExtension(field.Options, E_Customname)
 		if err == nil && v.(*string) != nil {
 		if err == nil && v.(*string) != nil {
@@ -155,6 +180,9 @@ func GetCustomName(field *google_protobuf.FieldDescriptorProto) string {
 }
 }
 
 
 func GetEnumCustomName(field *google_protobuf.EnumDescriptorProto) string {
 func GetEnumCustomName(field *google_protobuf.EnumDescriptorProto) string {
+	if field == nil {
+		return ""
+	}
 	if field.Options != nil {
 	if field.Options != nil {
 		v, err := proto.GetExtension(field.Options, E_EnumCustomname)
 		v, err := proto.GetExtension(field.Options, E_EnumCustomname)
 		if err == nil && v.(*string) != nil {
 		if err == nil && v.(*string) != nil {
@@ -165,6 +193,9 @@ func GetEnumCustomName(field *google_protobuf.EnumDescriptorProto) string {
 }
 }
 
 
 func GetEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) string {
 func GetEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) string {
+	if field == nil {
+		return ""
+	}
 	if field.Options != nil {
 	if field.Options != nil {
 		v, err := proto.GetExtension(field.Options, E_EnumvalueCustomname)
 		v, err := proto.GetExtension(field.Options, E_EnumvalueCustomname)
 		if err == nil && v.(*string) != nil {
 		if err == nil && v.(*string) != nil {
@@ -175,6 +206,9 @@ func GetEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) str
 }
 }
 
 
 func GetJsonTag(field *google_protobuf.FieldDescriptorProto) *string {
 func GetJsonTag(field *google_protobuf.FieldDescriptorProto) *string {
+	if field == nil {
+		return nil
+	}
 	if field.Options != nil {
 	if field.Options != nil {
 		v, err := proto.GetExtension(field.Options, E_Jsontag)
 		v, err := proto.GetExtension(field.Options, E_Jsontag)
 		if err == nil && v.(*string) != nil {
 		if err == nil && v.(*string) != nil {
@@ -185,6 +219,9 @@ func GetJsonTag(field *google_protobuf.FieldDescriptorProto) *string {
 }
 }
 
 
 func GetMoreTags(field *google_protobuf.FieldDescriptorProto) *string {
 func GetMoreTags(field *google_protobuf.FieldDescriptorProto) *string {
+	if field == nil {
+		return nil
+	}
 	if field.Options != nil {
 	if field.Options != nil {
 		v, err := proto.GetExtension(field.Options, E_Moretags)
 		v, err := proto.GetExtension(field.Options, E_Moretags)
 		if err == nil && v.(*string) != nil {
 		if err == nil && v.(*string) != nil {

+ 25 - 0
vendor/github.com/gogo/protobuf/gogoreplace/main.go

@@ -0,0 +1,25 @@
+package main
+
+import (
+	"bytes"
+	"fmt"
+	"io/ioutil"
+	"os"
+)
+
+func main() {
+	args := os.Args
+	if len(args) != 4 {
+		fmt.Println("gogoreplace wants three arguments")
+		fmt.Println("	gogoreplace oldsubstring newsubstring filename")
+		os.Exit(1)
+	}
+	data, err := ioutil.ReadFile(args[3])
+	if err != nil {
+		panic(err)
+	}
+	data = bytes.Replace(data, []byte(args[1]), []byte(args[2]), -1)
+	if err := ioutil.WriteFile(args[3], data, 0666); err != nil {
+		panic(err)
+	}
+}

+ 29 - 0
vendor/github.com/gogo/protobuf/install-protobuf.sh

@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+set -ex
+
+die() {
+    echo "$@" >&2
+    exit 1
+}
+
+case "$PROTOBUF_VERSION" in
+2*)
+    basename=protobuf-$PROTOBUF_VERSION
+    ;;
+3*)
+    basename=protobuf-cpp-$PROTOBUF_VERSION
+    ;;
+*)
+    die "unknown protobuf version: $PROTOBUF_VERSION"
+    ;;
+esac
+
+cd /home/travis
+
+wget https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/$basename.tar.gz
+tar xzf $basename.tar.gz
+
+cd protobuf-$PROTOBUF_VERSION
+
+./configure --prefix=/home/travis && make -j2 && make install

+ 3 - 3
vendor/github.com/gogo/protobuf/io/full.go

@@ -1,7 +1,7 @@
-// Extensions for Protocol Buffers to create more go like structures.
+// Protocol Buffers for Go with Gadgets
 //
 //
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // modification, are permitted provided that the following conditions are

+ 3 - 3
vendor/github.com/gogo/protobuf/io/io.go

@@ -1,7 +1,7 @@
-// Extensions for Protocol Buffers to create more go like structures.
+// Protocol Buffers for Go with Gadgets
 //
 //
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // modification, are permitted provided that the following conditions are

+ 221 - 0
vendor/github.com/gogo/protobuf/io/io_test.go

@@ -0,0 +1,221 @@
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package io_test
+
+import (
+	"bytes"
+	"encoding/binary"
+	"github.com/gogo/protobuf/io"
+	"github.com/gogo/protobuf/test"
+	goio "io"
+	"math/rand"
+	"testing"
+	"time"
+)
+
+func iotest(writer io.WriteCloser, reader io.ReadCloser) error {
+	size := 1000
+	msgs := make([]*test.NinOptNative, size)
+	r := rand.New(rand.NewSource(time.Now().UnixNano()))
+	for i := range msgs {
+		msgs[i] = test.NewPopulatedNinOptNative(r, true)
+		//issue 31
+		if i == 5 {
+			msgs[i] = &test.NinOptNative{}
+		}
+		//issue 31
+		if i == 999 {
+			msgs[i] = &test.NinOptNative{}
+		}
+		err := writer.WriteMsg(msgs[i])
+		if err != nil {
+			return err
+		}
+	}
+	if err := writer.Close(); err != nil {
+		return err
+	}
+	i := 0
+	for {
+		msg := &test.NinOptNative{}
+		if err := reader.ReadMsg(msg); err != nil {
+			if err == goio.EOF {
+				break
+			}
+			return err
+		}
+		if err := msg.VerboseEqual(msgs[i]); err != nil {
+			return err
+		}
+		i++
+	}
+	if i != size {
+		panic("not enough messages read")
+	}
+	if err := reader.Close(); err != nil {
+		return err
+	}
+	return nil
+}
+
+type buffer struct {
+	*bytes.Buffer
+	closed bool
+}
+
+func (this *buffer) Close() error {
+	this.closed = true
+	return nil
+}
+
+func newBuffer() *buffer {
+	return &buffer{bytes.NewBuffer(nil), false}
+}
+
+func TestBigUint32Normal(t *testing.T) {
+	buf := newBuffer()
+	writer := io.NewUint32DelimitedWriter(buf, binary.BigEndian)
+	reader := io.NewUint32DelimitedReader(buf, binary.BigEndian, 1024*1024)
+	if err := iotest(writer, reader); err != nil {
+		t.Error(err)
+	}
+	if !buf.closed {
+		t.Fatalf("did not close buffer")
+	}
+}
+
+func TestBigUint32MaxSize(t *testing.T) {
+	buf := newBuffer()
+	writer := io.NewUint32DelimitedWriter(buf, binary.BigEndian)
+	reader := io.NewUint32DelimitedReader(buf, binary.BigEndian, 20)
+	if err := iotest(writer, reader); err != goio.ErrShortBuffer {
+		t.Error(err)
+	} else {
+		t.Logf("%s", err)
+	}
+}
+
+func TestLittleUint32Normal(t *testing.T) {
+	buf := newBuffer()
+	writer := io.NewUint32DelimitedWriter(buf, binary.LittleEndian)
+	reader := io.NewUint32DelimitedReader(buf, binary.LittleEndian, 1024*1024)
+	if err := iotest(writer, reader); err != nil {
+		t.Error(err)
+	}
+	if !buf.closed {
+		t.Fatalf("did not close buffer")
+	}
+}
+
+func TestLittleUint32MaxSize(t *testing.T) {
+	buf := newBuffer()
+	writer := io.NewUint32DelimitedWriter(buf, binary.LittleEndian)
+	reader := io.NewUint32DelimitedReader(buf, binary.LittleEndian, 20)
+	if err := iotest(writer, reader); err != goio.ErrShortBuffer {
+		t.Error(err)
+	} else {
+		t.Logf("%s", err)
+	}
+}
+
+func TestVarintNormal(t *testing.T) {
+	buf := newBuffer()
+	writer := io.NewDelimitedWriter(buf)
+	reader := io.NewDelimitedReader(buf, 1024*1024)
+	if err := iotest(writer, reader); err != nil {
+		t.Error(err)
+	}
+	if !buf.closed {
+		t.Fatalf("did not close buffer")
+	}
+}
+
+func TestVarintNoClose(t *testing.T) {
+	buf := bytes.NewBuffer(nil)
+	writer := io.NewDelimitedWriter(buf)
+	reader := io.NewDelimitedReader(buf, 1024*1024)
+	if err := iotest(writer, reader); err != nil {
+		t.Error(err)
+	}
+}
+
+//issue 32
+func TestVarintMaxSize(t *testing.T) {
+	buf := newBuffer()
+	writer := io.NewDelimitedWriter(buf)
+	reader := io.NewDelimitedReader(buf, 20)
+	if err := iotest(writer, reader); err != goio.ErrShortBuffer {
+		t.Error(err)
+	} else {
+		t.Logf("%s", err)
+	}
+}
+
+func TestVarintError(t *testing.T) {
+	buf := newBuffer()
+	buf.Write([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f})
+	reader := io.NewDelimitedReader(buf, 1024*1024)
+	msg := &test.NinOptNative{}
+	err := reader.ReadMsg(msg)
+	if err == nil {
+		t.Fatalf("Expected error")
+	}
+}
+
+func TestFull(t *testing.T) {
+	buf := newBuffer()
+	writer := io.NewFullWriter(buf)
+	reader := io.NewFullReader(buf, 1024*1024)
+	r := rand.New(rand.NewSource(time.Now().UnixNano()))
+	msgIn := test.NewPopulatedNinOptNative(r, true)
+	if err := writer.WriteMsg(msgIn); err != nil {
+		panic(err)
+	}
+	if err := writer.Close(); err != nil {
+		panic(err)
+	}
+	msgOut := &test.NinOptNative{}
+	if err := reader.ReadMsg(msgOut); err != nil {
+		panic(err)
+	}
+	if err := msgIn.VerboseEqual(msgOut); err != nil {
+		panic(err)
+	}
+	if err := reader.ReadMsg(msgOut); err != nil {
+		if err != goio.EOF {
+			panic(err)
+		}
+	}
+	if err := reader.Close(); err != nil {
+		panic(err)
+	}
+	if !buf.closed {
+		t.Fatalf("did not close buffer")
+	}
+}

+ 3 - 3
vendor/github.com/gogo/protobuf/io/uint32.go

@@ -1,7 +1,7 @@
-// Extensions for Protocol Buffers to create more go like structures.
+// Protocol Buffers for Go with Gadgets
 //
 //
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // modification, are permitted provided that the following conditions are

+ 3 - 3
vendor/github.com/gogo/protobuf/io/varint.go

@@ -1,7 +1,7 @@
-// Extensions for Protocol Buffers to create more go like structures.
+// Protocol Buffers for Go with Gadgets
 //
 //
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // modification, are permitted provided that the following conditions are

+ 421 - 70
vendor/github.com/gogo/protobuf/jsonpb/jsonpb.go

@@ -41,18 +41,17 @@ package jsonpb
 import (
 import (
 	"bytes"
 	"bytes"
 	"encoding/json"
 	"encoding/json"
+	"errors"
 	"fmt"
 	"fmt"
 	"io"
 	"io"
 	"reflect"
 	"reflect"
 	"sort"
 	"sort"
 	"strconv"
 	"strconv"
 	"strings"
 	"strings"
+	"time"
 
 
 	"github.com/gogo/protobuf/proto"
 	"github.com/gogo/protobuf/proto"
-)
-
-var (
-	byteArrayType = reflect.TypeOf([]byte{})
+	"github.com/gogo/protobuf/types"
 )
 )
 
 
 // Marshaler is a configurable object for converting between
 // Marshaler is a configurable object for converting between
@@ -69,12 +68,15 @@ type Marshaler struct {
 	// value, and for newlines to be appear between fields and array
 	// value, and for newlines to be appear between fields and array
 	// elements.
 	// elements.
 	Indent string
 	Indent string
+
+	// Whether to use the original (.proto) name for fields.
+	OrigName bool
 }
 }
 
 
 // Marshal marshals a protocol buffer into JSON.
 // Marshal marshals a protocol buffer into JSON.
 func (m *Marshaler) Marshal(out io.Writer, pb proto.Message) error {
 func (m *Marshaler) Marshal(out io.Writer, pb proto.Message) error {
 	writer := &errWriter{writer: out}
 	writer := &errWriter{writer: out}
-	return m.marshalObject(writer, pb, "")
+	return m.marshalObject(writer, pb, "", "")
 }
 }
 
 
 // MarshalToString converts a protocol buffer object to JSON string.
 // MarshalToString converts a protocol buffer object to JSON string.
@@ -93,15 +95,83 @@ func (s int32Slice) Len() int           { return len(s) }
 func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] }
 func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] }
 func (s int32Slice) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
 func (s int32Slice) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
 
 
+type isWkt interface {
+	XXX_WellKnownType() string
+}
+
 // marshalObject writes a struct to the Writer.
 // marshalObject writes a struct to the Writer.
-func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent string) error {
+func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeURL string) error {
+	s := reflect.ValueOf(v).Elem()
+
+	// Handle well-known types.
+	if wkt, ok := v.(isWkt); ok {
+		switch wkt.XXX_WellKnownType() {
+		case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value",
+			"Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue":
+			// "Wrappers use the same representation in JSON
+			//  as the wrapped primitive type, ..."
+			sprop := proto.GetProperties(s.Type())
+			return m.marshalValue(out, sprop.Prop[0], s.Field(0), indent)
+		case "Any":
+			// Any is a bit more involved.
+			return m.marshalAny(out, v, indent)
+		case "Duration":
+			// "Generated output always contains 3, 6, or 9 fractional digits,
+			//  depending on required precision."
+			s, ns := s.Field(0).Int(), s.Field(1).Int()
+			d := time.Duration(s)*time.Second + time.Duration(ns)*time.Nanosecond
+			x := fmt.Sprintf("%.9f", d.Seconds())
+			x = strings.TrimSuffix(x, "000")
+			x = strings.TrimSuffix(x, "000")
+			out.write(`"`)
+			out.write(x)
+			out.write(`s"`)
+			return out.err
+		case "Struct":
+			// Let marshalValue handle the `fields` map.
+			// TODO: pass the correct Properties if needed.
+			return m.marshalValue(out, &proto.Properties{}, s.Field(0), indent)
+		case "Timestamp":
+			// "RFC 3339, where generated output will always be Z-normalized
+			//  and uses 3, 6 or 9 fractional digits."
+			s, ns := s.Field(0).Int(), s.Field(1).Int()
+			t := time.Unix(s, ns).UTC()
+			// time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits).
+			x := t.Format("2006-01-02T15:04:05.000000000")
+			x = strings.TrimSuffix(x, "000")
+			x = strings.TrimSuffix(x, "000")
+			out.write(`"`)
+			out.write(x)
+			out.write(`Z"`)
+			return out.err
+		case "Value":
+			// Value has a single oneof.
+			kind := s.Field(0)
+			if kind.IsNil() {
+				// "absence of any variant indicates an error"
+				return errors.New("nil Value")
+			}
+			// oneof -> *T -> T -> T.F
+			x := kind.Elem().Elem().Field(0)
+			// TODO: pass the correct Properties if needed.
+			return m.marshalValue(out, &proto.Properties{}, x, indent)
+		}
+	}
+
 	out.write("{")
 	out.write("{")
 	if m.Indent != "" {
 	if m.Indent != "" {
 		out.write("\n")
 		out.write("\n")
 	}
 	}
 
 
-	s := reflect.ValueOf(v).Elem()
 	firstField := true
 	firstField := true
+
+	if typeURL != "" {
+		if err := m.marshalTypeURL(out, indent, typeURL); err != nil {
+			return err
+		}
+		firstField = false
+	}
+
 	for i := 0; i < s.NumField(); i++ {
 	for i := 0; i < s.NumField(); i++ {
 		value := s.Field(i)
 		value := s.Field(i)
 		valueField := s.Type().Field(i)
 		valueField := s.Type().Field(i)
@@ -149,7 +219,7 @@ func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent string
 			value = sv.Field(0)
 			value = sv.Field(0)
 			valueField = sv.Type().Field(0)
 			valueField = sv.Type().Field(0)
 		}
 		}
-		prop := jsonProperties(valueField)
+		prop := jsonProperties(valueField, m.OrigName)
 		if !firstField {
 		if !firstField {
 			m.writeSep(out)
 			m.writeSep(out)
 		}
 		}
@@ -176,12 +246,14 @@ func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent string
 	}
 	}
 
 
 	// Handle proto2 extensions.
 	// Handle proto2 extensions.
-	if ep, ok := v.(extendableProto); ok {
+	if ep, ok := v.(proto.Message); ok {
 		extensions := proto.RegisteredExtensions(v)
 		extensions := proto.RegisteredExtensions(v)
-		extensionMap := ep.ExtensionMap()
 		// Sort extensions for stable output.
 		// Sort extensions for stable output.
-		ids := make([]int32, 0, len(extensionMap))
-		for id := range extensionMap {
+		ids := make([]int32, 0, len(extensions))
+		for id, desc := range extensions {
+			if !proto.HasExtension(ep, desc) {
+				continue
+			}
 			ids = append(ids, id)
 			ids = append(ids, id)
 		}
 		}
 		sort.Sort(int32Slice(ids))
 		sort.Sort(int32Slice(ids))
@@ -198,7 +270,7 @@ func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent string
 			value := reflect.ValueOf(ext)
 			value := reflect.ValueOf(ext)
 			var prop proto.Properties
 			var prop proto.Properties
 			prop.Parse(desc.Tag)
 			prop.Parse(desc.Tag)
-			prop.OrigName = fmt.Sprintf("[%s]", desc.Name)
+			prop.JSONName = fmt.Sprintf("[%s]", desc.Name)
 			if !firstField {
 			if !firstField {
 				m.writeSep(out)
 				m.writeSep(out)
 			}
 			}
@@ -226,6 +298,76 @@ func (m *Marshaler) writeSep(out *errWriter) {
 	}
 	}
 }
 }
 
 
+func (m *Marshaler) marshalAny(out *errWriter, any proto.Message, indent string) error {
+	// "If the Any contains a value that has a special JSON mapping,
+	//  it will be converted as follows: {"@type": xxx, "value": yyy}.
+	//  Otherwise, the value will be converted into a JSON object,
+	//  and the "@type" field will be inserted to indicate the actual data type."
+	v := reflect.ValueOf(any).Elem()
+	turl := v.Field(0).String()
+	val := v.Field(1).Bytes()
+
+	// Only the part of type_url after the last slash is relevant.
+	mname := turl
+	if slash := strings.LastIndex(mname, "/"); slash >= 0 {
+		mname = mname[slash+1:]
+	}
+	mt := proto.MessageType(mname)
+	if mt == nil {
+		return fmt.Errorf("unknown message type %q", mname)
+	}
+	msg := reflect.New(mt.Elem()).Interface().(proto.Message)
+	if err := proto.Unmarshal(val, msg); err != nil {
+		return err
+	}
+
+	if _, ok := msg.(isWkt); ok {
+		out.write("{")
+		if m.Indent != "" {
+			out.write("\n")
+		}
+		if err := m.marshalTypeURL(out, indent, turl); err != nil {
+			return err
+		}
+		m.writeSep(out)
+		if m.Indent != "" {
+			out.write(indent)
+			out.write(m.Indent)
+			out.write(`"value": `)
+		} else {
+			out.write(`"value":`)
+		}
+		if err := m.marshalObject(out, msg, indent+m.Indent, ""); err != nil {
+			return err
+		}
+		if m.Indent != "" {
+			out.write("\n")
+			out.write(indent)
+		}
+		out.write("}")
+		return out.err
+	}
+
+	return m.marshalObject(out, msg, indent, turl)
+}
+
+func (m *Marshaler) marshalTypeURL(out *errWriter, indent, typeURL string) error {
+	if m.Indent != "" {
+		out.write(indent)
+		out.write(m.Indent)
+	}
+	out.write(`"@type":`)
+	if m.Indent != "" {
+		out.write(" ")
+	}
+	b, err := json.Marshal(typeURL)
+	if err != nil {
+		return err
+	}
+	out.write(string(b))
+	return out.err
+}
+
 // marshalField writes field description and value to the Writer.
 // marshalField writes field description and value to the Writer.
 func (m *Marshaler) marshalField(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error {
 func (m *Marshaler) marshalField(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error {
 	if m.Indent != "" {
 	if m.Indent != "" {
@@ -233,7 +375,7 @@ func (m *Marshaler) marshalField(out *errWriter, prop *proto.Properties, v refle
 		out.write(m.Indent)
 		out.write(m.Indent)
 	}
 	}
 	out.write(`"`)
 	out.write(`"`)
-	out.write(prop.OrigName)
+	out.write(prop.JSONName)
 	out.write(`":`)
 	out.write(`":`)
 	if m.Indent != "" {
 	if m.Indent != "" {
 		out.write(" ")
 		out.write(" ")
@@ -250,7 +392,7 @@ func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v refle
 	v = reflect.Indirect(v)
 	v = reflect.Indirect(v)
 
 
 	// Handle repeated elements.
 	// Handle repeated elements.
-	if v.Type() != byteArrayType && v.Kind() == reflect.Slice {
+	if v.Kind() == reflect.Slice && v.Type().Elem().Kind() != reflect.Uint8 {
 		out.write("[")
 		out.write("[")
 		comma := ""
 		comma := ""
 		for i := 0; i < v.Len(); i++ {
 		for i := 0; i < v.Len(); i++ {
@@ -262,7 +404,9 @@ func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v refle
 				out.write(m.Indent)
 				out.write(m.Indent)
 				out.write(m.Indent)
 				out.write(m.Indent)
 			}
 			}
-			m.marshalValue(out, prop, sliceVal, indent+m.Indent)
+			if err := m.marshalValue(out, prop, sliceVal, indent+m.Indent); err != nil {
+				return err
+			}
 			comma = ","
 			comma = ","
 		}
 		}
 		if m.Indent != "" {
 		if m.Indent != "" {
@@ -274,6 +418,29 @@ func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v refle
 		return out.err
 		return out.err
 	}
 	}
 
 
+	// Handle well-known types.
+	// Most are handled up in marshalObject (because 99% are messages).
+	if wkt, ok := v.Interface().(isWkt); ok {
+		switch wkt.XXX_WellKnownType() {
+		case "NullValue":
+			out.write("null")
+			return out.err
+		}
+	}
+
+	if t, ok := v.Interface().(time.Time); ok {
+		ts, err := types.TimestampProto(t)
+		if err != nil {
+			return err
+		}
+		return m.marshalValue(out, prop, reflect.ValueOf(ts), indent)
+	}
+
+	if d, ok := v.Interface().(time.Duration); ok {
+		dur := types.DurationProto(d)
+		return m.marshalValue(out, prop, reflect.ValueOf(dur), indent)
+	}
+
 	// Handle enumerations.
 	// Handle enumerations.
 	if !m.EnumsAsInts && prop.Enum != "" {
 	if !m.EnumsAsInts && prop.Enum != "" {
 		// Unknown enum values will are stringified by the proto library as their
 		// Unknown enum values will are stringified by the proto library as their
@@ -338,7 +505,7 @@ func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v refle
 			}
 			}
 			pm = i.Convert(t).Interface().(proto.Message)
 			pm = i.Convert(t).Interface().(proto.Message)
 		}
 		}
-		return m.marshalObject(out, pm, indent+m.Indent)
+		return m.marshalObject(out, pm, indent+m.Indent, "")
 	}
 	}
 
 
 	// Handle maps.
 	// Handle maps.
@@ -408,32 +575,166 @@ func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v refle
 	return out.err
 	return out.err
 }
 }
 
 
+// Unmarshaler is a configurable object for converting from a JSON
+// representation to a protocol buffer object.
+type Unmarshaler struct {
+	// Whether to allow messages to contain unknown fields, as opposed to
+	// failing to unmarshal.
+	AllowUnknownFields bool
+}
+
+// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream.
+// This function is lenient and will decode any options permutations of the
+// related Marshaler.
+func (u *Unmarshaler) UnmarshalNext(dec *json.Decoder, pb proto.Message) error {
+	inputValue := json.RawMessage{}
+	if err := dec.Decode(&inputValue); err != nil {
+		return err
+	}
+	return u.unmarshalValue(reflect.ValueOf(pb).Elem(), inputValue, nil)
+}
+
+// Unmarshal unmarshals a JSON object stream into a protocol
+// buffer. This function is lenient and will decode any options
+// permutations of the related Marshaler.
+func (u *Unmarshaler) Unmarshal(r io.Reader, pb proto.Message) error {
+	dec := json.NewDecoder(r)
+	return u.UnmarshalNext(dec, pb)
+}
+
+// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream.
+// This function is lenient and will decode any options permutations of the
+// related Marshaler.
+func UnmarshalNext(dec *json.Decoder, pb proto.Message) error {
+	return new(Unmarshaler).UnmarshalNext(dec, pb)
+}
+
 // Unmarshal unmarshals a JSON object stream into a protocol
 // Unmarshal unmarshals a JSON object stream into a protocol
 // buffer. This function is lenient and will decode any options
 // buffer. This function is lenient and will decode any options
 // permutations of the related Marshaler.
 // permutations of the related Marshaler.
 func Unmarshal(r io.Reader, pb proto.Message) error {
 func Unmarshal(r io.Reader, pb proto.Message) error {
-	inputValue := json.RawMessage{}
-	if err := json.NewDecoder(r).Decode(&inputValue); err != nil {
-		return err
-	}
-	return unmarshalValue(reflect.ValueOf(pb).Elem(), inputValue)
+	return new(Unmarshaler).Unmarshal(r, pb)
 }
 }
 
 
 // UnmarshalString will populate the fields of a protocol buffer based
 // UnmarshalString will populate the fields of a protocol buffer based
 // on a JSON string. This function is lenient and will decode any options
 // on a JSON string. This function is lenient and will decode any options
 // permutations of the related Marshaler.
 // permutations of the related Marshaler.
 func UnmarshalString(str string, pb proto.Message) error {
 func UnmarshalString(str string, pb proto.Message) error {
-	return Unmarshal(strings.NewReader(str), pb)
+	return new(Unmarshaler).Unmarshal(strings.NewReader(str), pb)
 }
 }
 
 
 // unmarshalValue converts/copies a value into the target.
 // unmarshalValue converts/copies a value into the target.
-func unmarshalValue(target reflect.Value, inputValue json.RawMessage) error {
+// prop may be nil.
+func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMessage, prop *proto.Properties) error {
 	targetType := target.Type()
 	targetType := target.Type()
 
 
 	// Allocate memory for pointer fields.
 	// Allocate memory for pointer fields.
 	if targetType.Kind() == reflect.Ptr {
 	if targetType.Kind() == reflect.Ptr {
 		target.Set(reflect.New(targetType.Elem()))
 		target.Set(reflect.New(targetType.Elem()))
-		return unmarshalValue(target.Elem(), inputValue)
+		return u.unmarshalValue(target.Elem(), inputValue, prop)
+	}
+
+	// Handle well-known types.
+	if wkt, ok := target.Addr().Interface().(isWkt); ok {
+		switch wkt.XXX_WellKnownType() {
+		case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value",
+			"Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue":
+			// "Wrappers use the same representation in JSON
+			//  as the wrapped primitive type, except that null is allowed."
+			// encoding/json will turn JSON `null` into Go `nil`,
+			// so we don't have to do any extra work.
+			return u.unmarshalValue(target.Field(0), inputValue, prop)
+		case "Any":
+			return fmt.Errorf("unmarshaling Any not supported yet")
+		case "Duration":
+			ivStr := string(inputValue)
+			if ivStr == "null" {
+				target.Field(0).SetInt(0)
+				target.Field(1).SetInt(0)
+				return nil
+			}
+
+			unq, err := strconv.Unquote(ivStr)
+			if err != nil {
+				return err
+			}
+			d, err := time.ParseDuration(unq)
+			if err != nil {
+				return fmt.Errorf("bad Duration: %v", err)
+			}
+			ns := d.Nanoseconds()
+			s := ns / 1e9
+			ns %= 1e9
+			target.Field(0).SetInt(s)
+			target.Field(1).SetInt(ns)
+			return nil
+		case "Timestamp":
+			ivStr := string(inputValue)
+			if ivStr == "null" {
+				target.Field(0).SetInt(0)
+				target.Field(1).SetInt(0)
+				return nil
+			}
+
+			unq, err := strconv.Unquote(ivStr)
+			if err != nil {
+				return err
+			}
+			t, err := time.Parse(time.RFC3339Nano, unq)
+			if err != nil {
+				return fmt.Errorf("bad Timestamp: %v", err)
+			}
+			target.Field(0).SetInt(int64(t.Unix()))
+			target.Field(1).SetInt(int64(t.Nanosecond()))
+			return nil
+		}
+	}
+
+	if t, ok := target.Addr().Interface().(*time.Time); ok {
+		ts := &types.Timestamp{}
+		if err := u.unmarshalValue(reflect.ValueOf(ts).Elem(), inputValue, prop); err != nil {
+			return err
+		}
+		tt, err := types.TimestampFromProto(ts)
+		if err != nil {
+			return err
+		}
+		*t = tt
+		return nil
+	}
+
+	if d, ok := target.Addr().Interface().(*time.Duration); ok {
+		dur := &types.Duration{}
+		if err := u.unmarshalValue(reflect.ValueOf(dur).Elem(), inputValue, prop); err != nil {
+			return err
+		}
+		dd, err := types.DurationFromProto(dur)
+		if err != nil {
+			return err
+		}
+		*d = dd
+		return nil
+	}
+
+	// Handle enums, which have an underlying type of int32,
+	// and may appear as strings.
+	// The case of an enum appearing as a number is handled
+	// at the bottom of this function.
+	if inputValue[0] == '"' && prop != nil && prop.Enum != "" {
+		vmap := proto.EnumValueMap(prop.Enum)
+		// Don't need to do unquoting; valid enum names
+		// are from a limited character set.
+		s := inputValue[1 : len(inputValue)-1]
+		n, ok := vmap[string(s)]
+		if !ok {
+			return fmt.Errorf("unknown value %q for enum %s", s, prop.Enum)
+		}
+		if target.Kind() == reflect.Ptr { // proto2
+			target.Set(reflect.New(targetType.Elem()))
+			target = target.Elem()
+		}
+		target.SetInt(int64(n))
+		return nil
 	}
 	}
 
 
 	// Handle nested messages.
 	// Handle nested messages.
@@ -443,59 +744,58 @@ func unmarshalValue(target reflect.Value, inputValue json.RawMessage) error {
 			return err
 			return err
 		}
 		}
 
 
+		consumeField := func(prop *proto.Properties) (json.RawMessage, bool) {
+			// Be liberal in what names we accept; both orig_name and camelName are okay.
+			fieldNames := acceptedJSONFieldNames(prop)
+
+			vOrig, okOrig := jsonFields[fieldNames.orig]
+			vCamel, okCamel := jsonFields[fieldNames.camel]
+			if !okOrig && !okCamel {
+				return nil, false
+			}
+			// If, for some reason, both are present in the data, favour the camelName.
+			var raw json.RawMessage
+			if okOrig {
+				raw = vOrig
+				delete(jsonFields, fieldNames.orig)
+			}
+			if okCamel {
+				raw = vCamel
+				delete(jsonFields, fieldNames.camel)
+			}
+			return raw, true
+		}
+
 		sprops := proto.GetProperties(targetType)
 		sprops := proto.GetProperties(targetType)
 		for i := 0; i < target.NumField(); i++ {
 		for i := 0; i < target.NumField(); i++ {
 			ft := target.Type().Field(i)
 			ft := target.Type().Field(i)
 			if strings.HasPrefix(ft.Name, "XXX_") {
 			if strings.HasPrefix(ft.Name, "XXX_") {
 				continue
 				continue
 			}
 			}
-			fieldName := jsonProperties(ft).OrigName
-
-			valueForField, ok := jsonFields[fieldName]
+			valueForField, ok := consumeField(sprops.Prop[i])
 			if !ok {
 			if !ok {
 				continue
 				continue
 			}
 			}
-			delete(jsonFields, fieldName)
-
-			// Handle enums, which have an underlying type of int32,
-			// and may appear as strings. We do this while handling
-			// the struct so we have access to the enum info.
-			// The case of an enum appearing as a number is handled
-			// by the recursive call to unmarshalValue.
-			if enum := sprops.Prop[i].Enum; valueForField[0] == '"' && enum != "" {
-				vmap := proto.EnumValueMap(enum)
-				// Don't need to do unquoting; valid enum names
-				// are from a limited character set.
-				s := valueForField[1 : len(valueForField)-1]
-				n, ok := vmap[string(s)]
-				if !ok {
-					return fmt.Errorf("unknown value %q for enum %s", s, enum)
-				}
-				f := target.Field(i)
-				if f.Kind() == reflect.Ptr { // proto2
-					f.Set(reflect.New(f.Type().Elem()))
-					f = f.Elem()
-				}
-				f.SetInt(int64(n))
-				continue
-			}
 
 
-			if err := unmarshalValue(target.Field(i), valueForField); err != nil {
+			if err := u.unmarshalValue(target.Field(i), valueForField, sprops.Prop[i]); err != nil {
 				return err
 				return err
 			}
 			}
 		}
 		}
 		// Check for any oneof fields.
 		// Check for any oneof fields.
-		for fname, raw := range jsonFields {
-			if oop, ok := sprops.OneofTypes[fname]; ok {
+		if len(jsonFields) > 0 {
+			for _, oop := range sprops.OneofTypes {
+				raw, ok := consumeField(oop.Prop)
+				if !ok {
+					continue
+				}
 				nv := reflect.New(oop.Type.Elem())
 				nv := reflect.New(oop.Type.Elem())
 				target.Field(oop.Field).Set(nv)
 				target.Field(oop.Field).Set(nv)
-				if err := unmarshalValue(nv.Elem().Field(0), raw); err != nil {
+				if err := u.unmarshalValue(nv.Elem().Field(0), raw, oop.Prop); err != nil {
 					return err
 					return err
 				}
 				}
-				delete(jsonFields, fname)
 			}
 			}
 		}
 		}
-		if len(jsonFields) > 0 {
+		if !u.AllowUnknownFields && len(jsonFields) > 0 {
 			// Pick any field to be the scapegoat.
 			// Pick any field to be the scapegoat.
 			var f string
 			var f string
 			for fname := range jsonFields {
 			for fname := range jsonFields {
@@ -507,8 +807,33 @@ func unmarshalValue(target reflect.Value, inputValue json.RawMessage) error {
 		return nil
 		return nil
 	}
 	}
 
 
-	// Handle arrays (which aren't encoded bytes)
-	if targetType != byteArrayType && targetType.Kind() == reflect.Slice {
+	// Handle arrays
+	if targetType.Kind() == reflect.Slice {
+		if targetType.Elem().Kind() == reflect.Uint8 {
+			outRef := reflect.New(targetType)
+			outVal := outRef.Interface()
+			//CustomType with underlying type []byte
+			if _, ok := outVal.(interface {
+				UnmarshalJSON([]byte) error
+			}); ok {
+				if err := json.Unmarshal(inputValue, outVal); err != nil {
+					return err
+				}
+				target.Set(outRef.Elem())
+				return nil
+			}
+			// Special case for encoded bytes. Pre-go1.5 doesn't support unmarshalling
+			// strings into aliased []byte types.
+			// https://github.com/golang/go/commit/4302fd0409da5e4f1d71471a6770dacdc3301197
+			// https://github.com/golang/go/commit/c60707b14d6be26bf4213114d13070bff00d0b0a
+			var out []byte
+			if err := json.Unmarshal(inputValue, &out); err != nil {
+				return err
+			}
+			target.SetBytes(out)
+			return nil
+		}
+
 		var slc []json.RawMessage
 		var slc []json.RawMessage
 		if err := json.Unmarshal(inputValue, &slc); err != nil {
 		if err := json.Unmarshal(inputValue, &slc); err != nil {
 			return err
 			return err
@@ -516,7 +841,7 @@ func unmarshalValue(target reflect.Value, inputValue json.RawMessage) error {
 		len := len(slc)
 		len := len(slc)
 		target.Set(reflect.MakeSlice(targetType, len, len))
 		target.Set(reflect.MakeSlice(targetType, len, len))
 		for i := 0; i < len; i++ {
 		for i := 0; i < len; i++ {
-			if err := unmarshalValue(target.Index(i), slc[i]); err != nil {
+			if err := u.unmarshalValue(target.Index(i), slc[i], prop); err != nil {
 				return err
 				return err
 			}
 			}
 		}
 		}
@@ -530,6 +855,13 @@ func unmarshalValue(target reflect.Value, inputValue json.RawMessage) error {
 			return err
 			return err
 		}
 		}
 		target.Set(reflect.MakeMap(targetType))
 		target.Set(reflect.MakeMap(targetType))
+		var keyprop, valprop *proto.Properties
+		if prop != nil {
+			// These could still be nil if the protobuf metadata is broken somehow.
+			// TODO: This won't work because the fields are unexported.
+			// We should probably just reparse them.
+			//keyprop, valprop = prop.mkeyprop, prop.mvalprop
+		}
 		for ks, raw := range mp {
 		for ks, raw := range mp {
 			// Unmarshal map key. The core json library already decoded the key into a
 			// Unmarshal map key. The core json library already decoded the key into a
 			// string, so we handle that specially. Other types were quoted post-serialization.
 			// string, so we handle that specially. Other types were quoted post-serialization.
@@ -538,7 +870,7 @@ func unmarshalValue(target reflect.Value, inputValue json.RawMessage) error {
 				k = reflect.ValueOf(ks)
 				k = reflect.ValueOf(ks)
 			} else {
 			} else {
 				k = reflect.New(targetType.Key()).Elem()
 				k = reflect.New(targetType.Key()).Elem()
-				if err := unmarshalValue(k, json.RawMessage(ks)); err != nil {
+				if err := u.unmarshalValue(k, json.RawMessage(ks), keyprop); err != nil {
 					return err
 					return err
 				}
 				}
 			}
 			}
@@ -549,7 +881,7 @@ func unmarshalValue(target reflect.Value, inputValue json.RawMessage) error {
 
 
 			// Unmarshal map value.
 			// Unmarshal map value.
 			v := reflect.New(targetType.Elem()).Elem()
 			v := reflect.New(targetType.Elem()).Elem()
-			if err := unmarshalValue(v, raw); err != nil {
+			if err := u.unmarshalValue(v, raw, valprop); err != nil {
 				return err
 				return err
 			}
 			}
 			target.SetMapIndex(k, v)
 			target.SetMapIndex(k, v)
@@ -568,18 +900,26 @@ func unmarshalValue(target reflect.Value, inputValue json.RawMessage) error {
 	return json.Unmarshal(inputValue, target.Addr().Interface())
 	return json.Unmarshal(inputValue, target.Addr().Interface())
 }
 }
 
 
-// jsonProperties returns parsed proto.Properties for the field.
-func jsonProperties(f reflect.StructField) *proto.Properties {
+// jsonProperties returns parsed proto.Properties for the field and corrects JSONName attribute.
+func jsonProperties(f reflect.StructField, origName bool) *proto.Properties {
 	var prop proto.Properties
 	var prop proto.Properties
 	prop.Init(f.Type, f.Name, f.Tag.Get("protobuf"), &f)
 	prop.Init(f.Type, f.Name, f.Tag.Get("protobuf"), &f)
+	if origName || prop.JSONName == "" {
+		prop.JSONName = prop.OrigName
+	}
 	return &prop
 	return &prop
 }
 }
 
 
-// extendableProto is an interface implemented by any protocol buffer that may be extended.
-type extendableProto interface {
-	proto.Message
-	ExtensionRangeArray() []proto.ExtensionRange
-	ExtensionMap() map[int32]proto.Extension
+type fieldNames struct {
+	orig, camel string
+}
+
+func acceptedJSONFieldNames(prop *proto.Properties) fieldNames {
+	opts := fieldNames{orig: prop.OrigName, camel: prop.OrigName}
+	if prop.JSONName != "" {
+		opts.camel = prop.JSONName
+	}
+	return opts
 }
 }
 
 
 // Writer wrapper inspired by https://blog.golang.org/errors-are-values
 // Writer wrapper inspired by https://blog.golang.org/errors-are-values
@@ -599,10 +939,21 @@ func (w *errWriter) write(str string) {
 // The easiest way to sort them in some deterministic order is to use fmt.
 // The easiest way to sort them in some deterministic order is to use fmt.
 // If this turns out to be inefficient we can always consider other options,
 // If this turns out to be inefficient we can always consider other options,
 // such as doing a Schwartzian transform.
 // such as doing a Schwartzian transform.
+//
+// Numeric keys are sorted in numeric order per
+// https://developers.google.com/protocol-buffers/docs/proto#maps.
 type mapKeys []reflect.Value
 type mapKeys []reflect.Value
 
 
 func (s mapKeys) Len() int      { return len(s) }
 func (s mapKeys) Len() int      { return len(s) }
 func (s mapKeys) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
 func (s mapKeys) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
 func (s mapKeys) Less(i, j int) bool {
 func (s mapKeys) Less(i, j int) bool {
+	if k := s[i].Kind(); k == s[j].Kind() {
+		switch k {
+		case reflect.Int32, reflect.Int64:
+			return s[i].Int() < s[j].Int()
+		case reflect.Uint32, reflect.Uint64:
+			return s[i].Uint() < s[j].Uint()
+		}
+	}
 	return fmt.Sprint(s[i].Interface()) < fmt.Sprint(s[j].Interface())
 	return fmt.Sprint(s[i].Interface()) < fmt.Sprint(s[j].Interface())
 }
 }

+ 558 - 0
vendor/github.com/gogo/protobuf/jsonpb/jsonpb_test.go

@@ -0,0 +1,558 @@
+// Go support for Protocol Buffers - Google's data interchange format
+//
+// Copyright 2015 The Go Authors.  All rights reserved.
+// https://github.com/golang/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package jsonpb
+
+import (
+	"bytes"
+	"encoding/json"
+	"io"
+	"reflect"
+	"strings"
+	"testing"
+
+	pb "github.com/gogo/protobuf/jsonpb/jsonpb_test_proto"
+	"github.com/gogo/protobuf/proto"
+	proto3pb "github.com/gogo/protobuf/proto/proto3_proto"
+	"github.com/gogo/protobuf/types"
+)
+
+var (
+	marshaler = Marshaler{}
+
+	marshalerAllOptions = Marshaler{
+		Indent: "  ",
+	}
+
+	simpleObject = &pb.Simple{
+		OInt32:     proto.Int32(-32),
+		OInt64:     proto.Int64(-6400000000),
+		OUint32:    proto.Uint32(32),
+		OUint64:    proto.Uint64(6400000000),
+		OSint32:    proto.Int32(-13),
+		OSint64:    proto.Int64(-2600000000),
+		OFloat:     proto.Float32(3.14),
+		ODouble:    proto.Float64(6.02214179e23),
+		OBool:      proto.Bool(true),
+		OString:    proto.String("hello \"there\""),
+		OBytes:     []byte("beep boop"),
+		OCastBytes: pb.Bytes("wow"),
+	}
+
+	simpleObjectJSON = `{` +
+		`"oBool":true,` +
+		`"oInt32":-32,` +
+		`"oInt64":"-6400000000",` +
+		`"oUint32":32,` +
+		`"oUint64":"6400000000",` +
+		`"oSint32":-13,` +
+		`"oSint64":"-2600000000",` +
+		`"oFloat":3.14,` +
+		`"oDouble":6.02214179e+23,` +
+		`"oString":"hello \"there\"",` +
+		`"oBytes":"YmVlcCBib29w",` +
+		`"oCastBytes":"d293"` +
+		`}`
+
+	simpleObjectPrettyJSON = `{
+  "oBool": true,
+  "oInt32": -32,
+  "oInt64": "-6400000000",
+  "oUint32": 32,
+  "oUint64": "6400000000",
+  "oSint32": -13,
+  "oSint64": "-2600000000",
+  "oFloat": 3.14,
+  "oDouble": 6.02214179e+23,
+  "oString": "hello \"there\"",
+  "oBytes": "YmVlcCBib29w",
+  "oCastBytes": "d293"
+}`
+
+	repeatsObject = &pb.Repeats{
+		RBool:   []bool{true, false, true},
+		RInt32:  []int32{-3, -4, -5},
+		RInt64:  []int64{-123456789, -987654321},
+		RUint32: []uint32{1, 2, 3},
+		RUint64: []uint64{6789012345, 3456789012},
+		RSint32: []int32{-1, -2, -3},
+		RSint64: []int64{-6789012345, -3456789012},
+		RFloat:  []float32{3.14, 6.28},
+		RDouble: []float64{299792458 * 1e20, 6.62606957e-34},
+		RString: []string{"happy", "days"},
+		RBytes:  [][]byte{[]byte("skittles"), []byte("m&m's")},
+	}
+
+	repeatsObjectJSON = `{` +
+		`"rBool":[true,false,true],` +
+		`"rInt32":[-3,-4,-5],` +
+		`"rInt64":["-123456789","-987654321"],` +
+		`"rUint32":[1,2,3],` +
+		`"rUint64":["6789012345","3456789012"],` +
+		`"rSint32":[-1,-2,-3],` +
+		`"rSint64":["-6789012345","-3456789012"],` +
+		`"rFloat":[3.14,6.28],` +
+		`"rDouble":[2.99792458e+28,6.62606957e-34],` +
+		`"rString":["happy","days"],` +
+		`"rBytes":["c2tpdHRsZXM=","bSZtJ3M="]` +
+		`}`
+
+	repeatsObjectPrettyJSON = `{
+  "rBool": [
+    true,
+    false,
+    true
+  ],
+  "rInt32": [
+    -3,
+    -4,
+    -5
+  ],
+  "rInt64": [
+    "-123456789",
+    "-987654321"
+  ],
+  "rUint32": [
+    1,
+    2,
+    3
+  ],
+  "rUint64": [
+    "6789012345",
+    "3456789012"
+  ],
+  "rSint32": [
+    -1,
+    -2,
+    -3
+  ],
+  "rSint64": [
+    "-6789012345",
+    "-3456789012"
+  ],
+  "rFloat": [
+    3.14,
+    6.28
+  ],
+  "rDouble": [
+    2.99792458e+28,
+    6.62606957e-34
+  ],
+  "rString": [
+    "happy",
+    "days"
+  ],
+  "rBytes": [
+    "c2tpdHRsZXM=",
+    "bSZtJ3M="
+  ]
+}`
+
+	innerSimple   = &pb.Simple{OInt32: proto.Int32(-32)}
+	innerSimple2  = &pb.Simple{OInt64: proto.Int64(25)}
+	innerRepeats  = &pb.Repeats{RString: []string{"roses", "red"}}
+	innerRepeats2 = &pb.Repeats{RString: []string{"violets", "blue"}}
+	complexObject = &pb.Widget{
+		Color:    pb.Widget_GREEN.Enum(),
+		RColor:   []pb.Widget_Color{pb.Widget_RED, pb.Widget_GREEN, pb.Widget_BLUE},
+		Simple:   innerSimple,
+		RSimple:  []*pb.Simple{innerSimple, innerSimple2},
+		Repeats:  innerRepeats,
+		RRepeats: []*pb.Repeats{innerRepeats, innerRepeats2},
+	}
+
+	complexObjectJSON = `{"color":"GREEN",` +
+		`"rColor":["RED","GREEN","BLUE"],` +
+		`"simple":{"oInt32":-32},` +
+		`"rSimple":[{"oInt32":-32},{"oInt64":"25"}],` +
+		`"repeats":{"rString":["roses","red"]},` +
+		`"rRepeats":[{"rString":["roses","red"]},{"rString":["violets","blue"]}]` +
+		`}`
+
+	complexObjectPrettyJSON = `{
+  "color": "GREEN",
+  "rColor": [
+    "RED",
+    "GREEN",
+    "BLUE"
+  ],
+  "simple": {
+    "oInt32": -32
+  },
+  "rSimple": [
+    {
+      "oInt32": -32
+    },
+    {
+      "oInt64": "25"
+    }
+  ],
+  "repeats": {
+    "rString": [
+      "roses",
+      "red"
+    ]
+  },
+  "rRepeats": [
+    {
+      "rString": [
+        "roses",
+        "red"
+      ]
+    },
+    {
+      "rString": [
+        "violets",
+        "blue"
+      ]
+    }
+  ]
+}`
+
+	colorPrettyJSON = `{
+ "color": 2
+}`
+
+	colorListPrettyJSON = `{
+  "color": 1000,
+  "rColor": [
+    "RED"
+  ]
+}`
+
+	nummyPrettyJSON = `{
+  "nummy": {
+    "1": 2,
+    "3": 4
+  }
+}`
+
+	objjyPrettyJSON = `{
+  "objjy": {
+    "1": {
+      "dub": 1
+    }
+  }
+}`
+	realNumber     = &pb.Real{Value: proto.Float64(3.14159265359)}
+	realNumberName = "Pi"
+	complexNumber  = &pb.Complex{Imaginary: proto.Float64(0.5772156649)}
+	realNumberJSON = `{` +
+		`"value":3.14159265359,` +
+		`"[jsonpb.Complex.real_extension]":{"imaginary":0.5772156649},` +
+		`"[jsonpb.name]":"Pi"` +
+		`}`
+
+	anySimple = &pb.KnownTypes{
+		An: &types.Any{
+			TypeUrl: "something.example.com/jsonpb.Simple",
+			Value: []byte{
+				// &pb.Simple{OBool:true}
+				1 << 3, 1,
+			},
+		},
+	}
+	anySimpleJSON       = `{"an":{"@type":"something.example.com/jsonpb.Simple","oBool":true}}`
+	anySimplePrettyJSON = `{
+  "an": {
+    "@type": "something.example.com/jsonpb.Simple",
+    "oBool": true
+  }
+}`
+
+	anyWellKnown = &pb.KnownTypes{
+		An: &types.Any{
+			TypeUrl: "type.googleapis.com/google.protobuf.Duration",
+			Value: []byte{
+				// &durpb.Duration{Seconds: 1, Nanos: 212000000 }
+				1 << 3, 1, // seconds
+				2 << 3, 0x80, 0xba, 0x8b, 0x65, // nanos
+			},
+		},
+	}
+	anyWellKnownJSON       = `{"an":{"@type":"type.googleapis.com/google.protobuf.Duration","value":"1.212s"}}`
+	anyWellKnownPrettyJSON = `{
+  "an": {
+    "@type": "type.googleapis.com/google.protobuf.Duration",
+    "value": "1.212s"
+  }
+}`
+)
+
+func init() {
+	if err := proto.SetExtension(realNumber, pb.E_Name, &realNumberName); err != nil {
+		panic(err)
+	}
+	if err := proto.SetExtension(realNumber, pb.E_Complex_RealExtension, complexNumber); err != nil {
+		panic(err)
+	}
+}
+
+var marshalingTests = []struct {
+	desc      string
+	marshaler Marshaler
+	pb        proto.Message
+	json      string
+}{
+	{"simple flat object", marshaler, simpleObject, simpleObjectJSON},
+	{"simple pretty object", marshalerAllOptions, simpleObject, simpleObjectPrettyJSON},
+	{"repeated fields flat object", marshaler, repeatsObject, repeatsObjectJSON},
+	{"repeated fields pretty object", marshalerAllOptions, repeatsObject, repeatsObjectPrettyJSON},
+	{"nested message/enum flat object", marshaler, complexObject, complexObjectJSON},
+	{"nested message/enum pretty object", marshalerAllOptions, complexObject, complexObjectPrettyJSON},
+	{"enum-string flat object", Marshaler{},
+		&pb.Widget{Color: pb.Widget_BLUE.Enum()}, `{"color":"BLUE"}`},
+	{"enum-value pretty object", Marshaler{EnumsAsInts: true, Indent: " "},
+		&pb.Widget{Color: pb.Widget_BLUE.Enum()}, colorPrettyJSON},
+	{"unknown enum value object", marshalerAllOptions,
+		&pb.Widget{Color: pb.Widget_Color(1000).Enum(), RColor: []pb.Widget_Color{pb.Widget_RED}}, colorListPrettyJSON},
+	{"repeated proto3 enum", Marshaler{},
+		&proto3pb.Message{RFunny: []proto3pb.Message_Humour{
+			proto3pb.Message_PUNS,
+			proto3pb.Message_SLAPSTICK,
+		}},
+		`{"rFunny":["PUNS","SLAPSTICK"]}`},
+	{"repeated proto3 enum as int", Marshaler{EnumsAsInts: true},
+		&proto3pb.Message{RFunny: []proto3pb.Message_Humour{
+			proto3pb.Message_PUNS,
+			proto3pb.Message_SLAPSTICK,
+		}},
+		`{"rFunny":[1,2]}`},
+	{"empty value", marshaler, &pb.Simple3{}, `{}`},
+	{"empty value emitted", Marshaler{EmitDefaults: true}, &pb.Simple3{}, `{"dub":0}`},
+	{"map<int64, int32>", marshaler, &pb.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}, `{"nummy":{"1":2,"3":4}}`},
+	{"map<int64, int32>", marshalerAllOptions, &pb.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}, nummyPrettyJSON},
+	{"map<string, string>", marshaler,
+		&pb.Mappy{Strry: map[string]string{`"one"`: "two", "three": "four"}},
+		`{"strry":{"\"one\"":"two","three":"four"}}`},
+	{"map<int32, Object>", marshaler,
+		&pb.Mappy{Objjy: map[int32]*pb.Simple3{1: {Dub: 1}}}, `{"objjy":{"1":{"dub":1}}}`},
+	{"map<int32, Object>", marshalerAllOptions,
+		&pb.Mappy{Objjy: map[int32]*pb.Simple3{1: {Dub: 1}}}, objjyPrettyJSON},
+	{"map<int64, string>", marshaler, &pb.Mappy{Buggy: map[int64]string{1234: "yup"}},
+		`{"buggy":{"1234":"yup"}}`},
+	{"map<bool, bool>", marshaler, &pb.Mappy{Booly: map[bool]bool{false: true}}, `{"booly":{"false":true}}`},
+	// TODO: This is broken.
+	//{"map<string, enum>", marshaler, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}, `{"enumy":{"XIV":"ROMAN"}`},
+	{"map<string, enum as int>", Marshaler{EnumsAsInts: true}, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}, `{"enumy":{"XIV":2}}`},
+	{"map<int32, bool>", marshaler, &pb.Mappy{S32Booly: map[int32]bool{1: true, 3: false, 10: true, 12: false}}, `{"s32booly":{"1":true,"3":false,"10":true,"12":false}}`},
+	{"map<int64, bool>", marshaler, &pb.Mappy{S64Booly: map[int64]bool{1: true, 3: false, 10: true, 12: false}}, `{"s64booly":{"1":true,"3":false,"10":true,"12":false}}`},
+	{"map<uint32, bool>", marshaler, &pb.Mappy{U32Booly: map[uint32]bool{1: true, 3: false, 10: true, 12: false}}, `{"u32booly":{"1":true,"3":false,"10":true,"12":false}}`},
+	{"map<uint64, bool>", marshaler, &pb.Mappy{U64Booly: map[uint64]bool{1: true, 3: false, 10: true, 12: false}}, `{"u64booly":{"1":true,"3":false,"10":true,"12":false}}`},
+	{"proto2 map<int64, string>", marshaler, &pb.Maps{MInt64Str: map[int64]string{213: "cat"}},
+		`{"mInt64Str":{"213":"cat"}}`},
+	{"proto2 map<bool, Object>", marshaler,
+		&pb.Maps{MBoolSimple: map[bool]*pb.Simple{true: {OInt32: proto.Int32(1)}}},
+		`{"mBoolSimple":{"true":{"oInt32":1}}}`},
+	{"oneof, not set", marshaler, &pb.MsgWithOneof{}, `{}`},
+	{"oneof, set", marshaler, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Title{Title: "Grand Poobah"}}, `{"title":"Grand Poobah"}`},
+	{"force orig_name", Marshaler{OrigName: true}, &pb.Simple{OInt32: proto.Int32(4)},
+		`{"o_int32":4}`},
+	{"proto2 extension", marshaler, realNumber, realNumberJSON},
+	{"Any with message", marshaler, anySimple, anySimpleJSON},
+	{"Any with message and indent", marshalerAllOptions, anySimple, anySimplePrettyJSON},
+	{"Any with WKT", marshaler, anyWellKnown, anyWellKnownJSON},
+	{"Any with WKT and indent", marshalerAllOptions, anyWellKnown, anyWellKnownPrettyJSON},
+	{"Duration", marshaler, &pb.KnownTypes{Dur: &types.Duration{Seconds: 3}}, `{"dur":"3.000s"}`},
+	{"Struct", marshaler, &pb.KnownTypes{St: &types.Struct{
+		Fields: map[string]*types.Value{
+			"one": {Kind: &types.Value_StringValue{StringValue: "loneliest number"}},
+			"two": {Kind: &types.Value_NullValue{NullValue: types.NULL_VALUE}},
+		},
+	}}, `{"st":{"one":"loneliest number","two":null}}`},
+	{"Timestamp", marshaler, &pb.KnownTypes{Ts: &types.Timestamp{Seconds: 14e8, Nanos: 21e6}}, `{"ts":"2014-05-13T16:53:20.021Z"}`},
+	{"DoubleValue", marshaler, &pb.KnownTypes{Dbl: &types.DoubleValue{Value: 1.2}}, `{"dbl":1.2}`},
+	{"FloatValue", marshaler, &pb.KnownTypes{Flt: &types.FloatValue{Value: 1.2}}, `{"flt":1.2}`},
+	{"Int64Value", marshaler, &pb.KnownTypes{I64: &types.Int64Value{Value: -3}}, `{"i64":"-3"}`},
+	{"UInt64Value", marshaler, &pb.KnownTypes{U64: &types.UInt64Value{Value: 3}}, `{"u64":"3"}`},
+	{"Int32Value", marshaler, &pb.KnownTypes{I32: &types.Int32Value{Value: -4}}, `{"i32":-4}`},
+	{"UInt32Value", marshaler, &pb.KnownTypes{U32: &types.UInt32Value{Value: 4}}, `{"u32":4}`},
+	{"BoolValue", marshaler, &pb.KnownTypes{Bool: &types.BoolValue{Value: true}}, `{"bool":true}`},
+	{"StringValue", marshaler, &pb.KnownTypes{Str: &types.StringValue{Value: "plush"}}, `{"str":"plush"}`},
+	{"BytesValue", marshaler, &pb.KnownTypes{Bytes: &types.BytesValue{Value: []byte("wow")}}, `{"bytes":"d293"}`},
+}
+
+func TestMarshaling(t *testing.T) {
+	for _, tt := range marshalingTests {
+		json, err := tt.marshaler.MarshalToString(tt.pb)
+		if err != nil {
+			t.Errorf("%s: marshaling error: %v", tt.desc, err)
+		} else if tt.json != json {
+			t.Errorf("%s: got [%v] want [%v]", tt.desc, json, tt.json)
+		}
+	}
+}
+
+var unmarshalingTests = []struct {
+	desc        string
+	unmarshaler Unmarshaler
+	json        string
+	pb          proto.Message
+}{
+	{"simple flat object", Unmarshaler{}, simpleObjectJSON, simpleObject},
+	{"simple pretty object", Unmarshaler{}, simpleObjectPrettyJSON, simpleObject},
+	{"repeated fields flat object", Unmarshaler{}, repeatsObjectJSON, repeatsObject},
+	{"repeated fields pretty object", Unmarshaler{}, repeatsObjectPrettyJSON, repeatsObject},
+	{"nested message/enum flat object", Unmarshaler{}, complexObjectJSON, complexObject},
+	{"nested message/enum pretty object", Unmarshaler{}, complexObjectPrettyJSON, complexObject},
+	{"enum-string object", Unmarshaler{}, `{"color":"BLUE"}`, &pb.Widget{Color: pb.Widget_BLUE.Enum()}},
+	{"enum-value object", Unmarshaler{}, "{\n \"color\": 2\n}", &pb.Widget{Color: pb.Widget_BLUE.Enum()}},
+	{"unknown field with allowed option", Unmarshaler{AllowUnknownFields: true}, `{"unknown": "foo"}`, new(pb.Simple)},
+	{"proto3 enum string", Unmarshaler{}, `{"hilarity":"PUNS"}`, &proto3pb.Message{Hilarity: proto3pb.Message_PUNS}},
+	{"proto3 enum value", Unmarshaler{}, `{"hilarity":1}`, &proto3pb.Message{Hilarity: proto3pb.Message_PUNS}},
+	{"unknown enum value object",
+		Unmarshaler{},
+		"{\n  \"color\": 1000,\n  \"r_color\": [\n    \"RED\"\n  ]\n}",
+		&pb.Widget{Color: pb.Widget_Color(1000).Enum(), RColor: []pb.Widget_Color{pb.Widget_RED}}},
+	{"repeated proto3 enum", Unmarshaler{}, `{"rFunny":["PUNS","SLAPSTICK"]}`,
+		&proto3pb.Message{RFunny: []proto3pb.Message_Humour{
+			proto3pb.Message_PUNS,
+			proto3pb.Message_SLAPSTICK,
+		}}},
+	{"repeated proto3 enum as int", Unmarshaler{}, `{"rFunny":[1,2]}`,
+		&proto3pb.Message{RFunny: []proto3pb.Message_Humour{
+			proto3pb.Message_PUNS,
+			proto3pb.Message_SLAPSTICK,
+		}}},
+	{"repeated proto3 enum as mix of strings and ints", Unmarshaler{}, `{"rFunny":["PUNS",2]}`,
+		&proto3pb.Message{RFunny: []proto3pb.Message_Humour{
+			proto3pb.Message_PUNS,
+			proto3pb.Message_SLAPSTICK,
+		}}},
+	{"unquoted int64 object", Unmarshaler{}, `{"oInt64":-314}`, &pb.Simple{OInt64: proto.Int64(-314)}},
+	{"unquoted uint64 object", Unmarshaler{}, `{"oUint64":123}`, &pb.Simple{OUint64: proto.Uint64(123)}},
+	{"map<int64, int32>", Unmarshaler{}, `{"nummy":{"1":2,"3":4}}`, &pb.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}},
+	{"map<string, string>", Unmarshaler{}, `{"strry":{"\"one\"":"two","three":"four"}}`, &pb.Mappy{Strry: map[string]string{`"one"`: "two", "three": "four"}}},
+	{"map<int32, Object>", Unmarshaler{}, `{"objjy":{"1":{"dub":1}}}`, &pb.Mappy{Objjy: map[int32]*pb.Simple3{1: {Dub: 1}}}},
+	// TODO: This is broken.
+	//{"map<string, enum>", Unmarshaler{}, `{"enumy":{"XIV":"ROMAN"}`, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}},
+	{"map<string, enum as int>", Unmarshaler{}, `{"enumy":{"XIV":2}}`, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}},
+	{"oneof", Unmarshaler{}, `{"salary":31000}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Salary{Salary: 31000}}},
+	{"oneof spec name", Unmarshaler{}, `{"Country":"Australia"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Country{Country: "Australia"}}},
+	{"oneof orig_name", Unmarshaler{}, `{"Country":"Australia"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Country{Country: "Australia"}}},
+	{"oneof spec name2", Unmarshaler{}, `{"homeAddress":"Australia"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_HomeAddress{HomeAddress: "Australia"}}},
+	{"oneof orig_name2", Unmarshaler{}, `{"home_address":"Australia"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_HomeAddress{HomeAddress: "Australia"}}},
+	{"orig_name input", Unmarshaler{}, `{"o_bool":true}`, &pb.Simple{OBool: proto.Bool(true)}},
+	{"camelName input", Unmarshaler{}, `{"oBool":true}`, &pb.Simple{OBool: proto.Bool(true)}},
+	{"Duration", Unmarshaler{}, `{"dur":"3.000s"}`, &pb.KnownTypes{Dur: &types.Duration{Seconds: 3}}},
+	{"null Duration", Unmarshaler{}, `{"dur":null}`, &pb.KnownTypes{Dur: &types.Duration{Seconds: 0}}},
+	{"Timestamp", Unmarshaler{}, `{"ts":"2014-05-13T16:53:20.021Z"}`, &pb.KnownTypes{Ts: &types.Timestamp{Seconds: 14e8, Nanos: 21e6}}},
+	{"PreEpochTimestamp", Unmarshaler{}, `{"ts":"1969-12-31T23:59:58.999999995Z"}`, &pb.KnownTypes{Ts: &types.Timestamp{Seconds: -2, Nanos: 999999995}}},
+	{"ZeroTimeTimestamp", Unmarshaler{}, `{"ts":"0001-01-01T00:00:00Z"}`, &pb.KnownTypes{Ts: &types.Timestamp{Seconds: -62135596800, Nanos: 0}}},
+	{"null Timestamp", Unmarshaler{}, `{"ts":null}`, &pb.KnownTypes{Ts: &types.Timestamp{Seconds: 0, Nanos: 0}}},
+	{"DoubleValue", Unmarshaler{}, `{"dbl":1.2}`, &pb.KnownTypes{Dbl: &types.DoubleValue{Value: 1.2}}},
+	{"FloatValue", Unmarshaler{}, `{"flt":1.2}`, &pb.KnownTypes{Flt: &types.FloatValue{Value: 1.2}}},
+	{"Int64Value", Unmarshaler{}, `{"i64":"-3"}`, &pb.KnownTypes{I64: &types.Int64Value{Value: -3}}},
+	{"UInt64Value", Unmarshaler{}, `{"u64":"3"}`, &pb.KnownTypes{U64: &types.UInt64Value{Value: 3}}},
+	{"Int32Value", Unmarshaler{}, `{"i32":-4}`, &pb.KnownTypes{I32: &types.Int32Value{Value: -4}}},
+	{"UInt32Value", Unmarshaler{}, `{"u32":4}`, &pb.KnownTypes{U32: &types.UInt32Value{Value: 4}}},
+	{"BoolValue", Unmarshaler{}, `{"bool":true}`, &pb.KnownTypes{Bool: &types.BoolValue{Value: true}}},
+	{"StringValue", Unmarshaler{}, `{"str":"plush"}`, &pb.KnownTypes{Str: &types.StringValue{Value: "plush"}}},
+	{"BytesValue", Unmarshaler{}, `{"bytes":"d293"}`, &pb.KnownTypes{Bytes: &types.BytesValue{Value: []byte("wow")}}},
+	// `null` is also a permissible value. Let's just test one.
+	{"null DoubleValue", Unmarshaler{}, `{"dbl":null}`, &pb.KnownTypes{Dbl: &types.DoubleValue{}}},
+}
+
+func TestUnmarshaling(t *testing.T) {
+	for _, tt := range unmarshalingTests {
+		// Make a new instance of the type of our expected object.
+		p := reflect.New(reflect.TypeOf(tt.pb).Elem()).Interface().(proto.Message)
+
+		err := tt.unmarshaler.Unmarshal(strings.NewReader(tt.json), p)
+		if err != nil {
+			t.Errorf("%s: %v", tt.desc, err)
+			continue
+		}
+
+		// For easier diffs, compare text strings of the protos.
+		exp := proto.MarshalTextString(tt.pb)
+		act := proto.MarshalTextString(p)
+		if string(exp) != string(act) {
+			t.Errorf("%s: got [%s] want [%s]", tt.desc, act, exp)
+		}
+	}
+}
+
+func TestUnmarshalNext(t *testing.T) {
+	// We only need to check against a few, not all of them.
+	tests := unmarshalingTests[:5]
+
+	// Create a buffer with many concatenated JSON objects.
+	var b bytes.Buffer
+	for _, tt := range tests {
+		b.WriteString(tt.json)
+	}
+
+	dec := json.NewDecoder(&b)
+	for _, tt := range tests {
+		// Make a new instance of the type of our expected object.
+		p := reflect.New(reflect.TypeOf(tt.pb).Elem()).Interface().(proto.Message)
+
+		err := tt.unmarshaler.UnmarshalNext(dec, p)
+		if err != nil {
+			t.Errorf("%s: %v", tt.desc, err)
+			continue
+		}
+
+		// For easier diffs, compare text strings of the protos.
+		exp := proto.MarshalTextString(tt.pb)
+		act := proto.MarshalTextString(p)
+		if string(exp) != string(act) {
+			t.Errorf("%s: got [%s] want [%s]", tt.desc, act, exp)
+		}
+	}
+
+	p := &pb.Simple{}
+	err := new(Unmarshaler).UnmarshalNext(dec, p)
+	if err != io.EOF {
+		t.Errorf("eof: got %v, expected io.EOF", err)
+	}
+}
+
+var unmarshalingShouldError = []struct {
+	desc string
+	in   string
+	pb   proto.Message
+}{
+	{"a value", "666", new(pb.Simple)},
+	{"gibberish", "{adskja123;l23=-=", new(pb.Simple)},
+	{"unknown field", `{"unknown": "foo"}`, new(pb.Simple)},
+	{"unknown enum name", `{"hilarity":"DAVE"}`, new(proto3pb.Message)},
+}
+
+func TestUnmarshalingBadInput(t *testing.T) {
+	for _, tt := range unmarshalingShouldError {
+		err := UnmarshalString(tt.in, tt.pb)
+		if err == nil {
+			t.Errorf("an error was expected when parsing %q instead of an object", tt.desc)
+		}
+	}
+}

+ 33 - 0
vendor/github.com/gogo/protobuf/jsonpb/jsonpb_test_proto/Makefile

@@ -0,0 +1,33 @@
+# Go support for Protocol Buffers - Google's data interchange format
+#
+# Copyright 2015 The Go Authors.  All rights reserved.
+# https://github.com/golang/protobuf
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+regenerate:
+	protoc-min-version --version="3.0.0" --gogo_out=Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types:. *.proto -I . -I ../../ -I ../../protobuf/

+ 7 - 0
vendor/github.com/gogo/protobuf/jsonpb/jsonpb_test_proto/bytes.go

@@ -0,0 +1,7 @@
+package jsonpb
+
+// Byte is used to test that []byte type aliases are serialized to base64.
+type Byte byte
+
+// Bytes is used to test that []byte type aliases are serialized to base64.
+type Bytes []Byte

+ 112 - 25
vendor/github.com/gogo/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.pb.go

@@ -19,6 +19,7 @@ It has these top-level messages:
 	MsgWithOneof
 	MsgWithOneof
 	Real
 	Real
 	Complex
 	Complex
+	KnownTypes
 */
 */
 package jsonpb
 package jsonpb
 
 
@@ -33,7 +34,33 @@ var _ = math.Inf
 
 
 // This is a compile-time assertion to ensure that this generated file
 // This is a compile-time assertion to ensure that this generated file
 // is compatible with the proto package it is being compiled against.
 // is compatible with the proto package it is being compiled against.
-const _ = proto.GoGoProtoPackageIsVersion1
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
+
+type Numeral int32
+
+const (
+	Numeral_UNKNOWN Numeral = 0
+	Numeral_ARABIC  Numeral = 1
+	Numeral_ROMAN   Numeral = 2
+)
+
+var Numeral_name = map[int32]string{
+	0: "UNKNOWN",
+	1: "ARABIC",
+	2: "ROMAN",
+}
+var Numeral_value = map[string]int32{
+	"UNKNOWN": 0,
+	"ARABIC":  1,
+	"ROMAN":   2,
+}
+
+func (x Numeral) String() string {
+	return proto.EnumName(Numeral_name, int32(x))
+}
+func (Numeral) EnumDescriptor() ([]byte, []int) { return fileDescriptorMoreTestObjects, []int{0} }
 
 
 type Simple3 struct {
 type Simple3 struct {
 	Dub float64 `protobuf:"fixed64,1,opt,name=dub,proto3" json:"dub,omitempty"`
 	Dub float64 `protobuf:"fixed64,1,opt,name=dub,proto3" json:"dub,omitempty"`
@@ -44,12 +71,24 @@ func (m *Simple3) String() string            { return proto.CompactTextString(m)
 func (*Simple3) ProtoMessage()               {}
 func (*Simple3) ProtoMessage()               {}
 func (*Simple3) Descriptor() ([]byte, []int) { return fileDescriptorMoreTestObjects, []int{0} }
 func (*Simple3) Descriptor() ([]byte, []int) { return fileDescriptorMoreTestObjects, []int{0} }
 
 
+func (m *Simple3) GetDub() float64 {
+	if m != nil {
+		return m.Dub
+	}
+	return 0
+}
+
 type Mappy struct {
 type Mappy struct {
-	Nummy map[int64]int32    `protobuf:"bytes,1,rep,name=nummy" json:"nummy,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
-	Strry map[string]string  `protobuf:"bytes,2,rep,name=strry" json:"strry,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
-	Objjy map[int32]*Simple3 `protobuf:"bytes,3,rep,name=objjy" json:"objjy,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"`
-	Buggy map[int64]string   `protobuf:"bytes,4,rep,name=buggy" json:"buggy,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
-	Booly map[bool]bool      `protobuf:"bytes,5,rep,name=booly" json:"booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
+	Nummy    map[int64]int32    `protobuf:"bytes,1,rep,name=nummy" json:"nummy,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
+	Strry    map[string]string  `protobuf:"bytes,2,rep,name=strry" json:"strry,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+	Objjy    map[int32]*Simple3 `protobuf:"bytes,3,rep,name=objjy" json:"objjy,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"`
+	Buggy    map[int64]string   `protobuf:"bytes,4,rep,name=buggy" json:"buggy,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+	Booly    map[bool]bool      `protobuf:"bytes,5,rep,name=booly" json:"booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
+	Enumy    map[string]Numeral `protobuf:"bytes,6,rep,name=enumy" json:"enumy,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=jsonpb.Numeral"`
+	S32Booly map[int32]bool     `protobuf:"bytes,7,rep,name=s32booly" json:"s32booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
+	S64Booly map[int64]bool     `protobuf:"bytes,8,rep,name=s64booly" json:"s64booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
+	U32Booly map[uint32]bool    `protobuf:"bytes,9,rep,name=u32booly" json:"u32booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
+	U64Booly map[uint64]bool    `protobuf:"bytes,10,rep,name=u64booly" json:"u64booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
 }
 }
 
 
 func (m *Mappy) Reset()                    { *m = Mappy{} }
 func (m *Mappy) Reset()                    { *m = Mappy{} }
@@ -92,29 +131,77 @@ func (m *Mappy) GetBooly() map[bool]bool {
 	return nil
 	return nil
 }
 }
 
 
+func (m *Mappy) GetEnumy() map[string]Numeral {
+	if m != nil {
+		return m.Enumy
+	}
+	return nil
+}
+
+func (m *Mappy) GetS32Booly() map[int32]bool {
+	if m != nil {
+		return m.S32Booly
+	}
+	return nil
+}
+
+func (m *Mappy) GetS64Booly() map[int64]bool {
+	if m != nil {
+		return m.S64Booly
+	}
+	return nil
+}
+
+func (m *Mappy) GetU32Booly() map[uint32]bool {
+	if m != nil {
+		return m.U32Booly
+	}
+	return nil
+}
+
+func (m *Mappy) GetU64Booly() map[uint64]bool {
+	if m != nil {
+		return m.U64Booly
+	}
+	return nil
+}
+
 func init() {
 func init() {
 	proto.RegisterType((*Simple3)(nil), "jsonpb.Simple3")
 	proto.RegisterType((*Simple3)(nil), "jsonpb.Simple3")
 	proto.RegisterType((*Mappy)(nil), "jsonpb.Mappy")
 	proto.RegisterType((*Mappy)(nil), "jsonpb.Mappy")
+	proto.RegisterEnum("jsonpb.Numeral", Numeral_name, Numeral_value)
 }
 }
 
 
+func init() { proto.RegisterFile("more_test_objects.proto", fileDescriptorMoreTestObjects) }
+
 var fileDescriptorMoreTestObjects = []byte{
 var fileDescriptorMoreTestObjects = []byte{
-	// 288 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x92, 0x41, 0x4b, 0xc3, 0x30,
-	0x14, 0xc7, 0xe9, 0xba, 0xcc, 0xf5, 0xed, 0xa0, 0x14, 0xc1, 0xa0, 0x17, 0x19, 0x08, 0x3d, 0xe5,
-	0xb0, 0x5d, 0x86, 0x47, 0xc1, 0x83, 0x07, 0x15, 0xba, 0x0f, 0x30, 0x16, 0x0d, 0xc3, 0xda, 0x36,
-	0x21, 0x4d, 0x85, 0x7c, 0x25, 0x3f, 0xa5, 0x7d, 0x69, 0x67, 0xc3, 0x08, 0xec, 0xf6, 0xca, 0xff,
-	0xf7, 0x83, 0xf7, 0x7f, 0x0d, 0xdc, 0x54, 0x52, 0x8b, 0x9d, 0x11, 0x8d, 0xd9, 0x49, 0x5e, 0x88,
-	0x0f, 0xd3, 0x30, 0xa5, 0xa5, 0x91, 0xe9, 0xac, 0x68, 0x64, 0xad, 0xf8, 0xf2, 0x0e, 0x2e, 0xb6,
-	0x5f, 0x95, 0x2a, 0xc5, 0x3a, 0xbd, 0x82, 0xf8, 0xb3, 0xe5, 0x34, 0xba, 0x8f, 0xb2, 0x28, 0xc7,
-	0x71, 0xf9, 0x3b, 0x05, 0xf2, 0xba, 0x57, 0xca, 0xa6, 0x0c, 0x48, 0xdd, 0x56, 0x95, 0xed, 0xd2,
-	0x38, 0x5b, 0xac, 0x28, 0xeb, 0x75, 0xe6, 0x52, 0xf6, 0x86, 0xd1, 0x73, 0x6d, 0xb4, 0xcd, 0x7b,
-	0x0c, 0xf9, 0xc6, 0x68, 0x6d, 0xe9, 0x24, 0xc4, 0x6f, 0x31, 0x1a, 0x78, 0x87, 0x21, 0xdf, 0xed,
-	0x57, 0x58, 0x1a, 0x87, 0xf8, 0x77, 0x8c, 0x06, 0xde, 0x61, 0xc8, 0xf3, 0xf6, 0x70, 0xb0, 0x74,
-	0x1a, 0xe2, 0x9f, 0x30, 0x1a, 0x78, 0x87, 0x39, 0x5e, 0xca, 0xd2, 0x52, 0x12, 0xe4, 0x31, 0x3a,
-	0xf2, 0x38, 0xdf, 0x6e, 0x00, 0xc6, 0x52, 0x78, 0x99, 0x6f, 0x61, 0xdd, 0x65, 0xe2, 0x1c, 0xc7,
-	0xf4, 0x1a, 0xc8, 0xcf, 0xbe, 0x6c, 0x45, 0xd7, 0x2f, 0xca, 0x48, 0xde, 0x7f, 0x3c, 0x4e, 0x36,
-	0x11, 0x9a, 0x63, 0x3d, 0xdf, 0x4c, 0x02, 0x66, 0xe2, 0x9b, 0x2f, 0x00, 0x63, 0x51, 0xdf, 0x24,
-	0xbd, 0xf9, 0xe0, 0x9b, 0x8b, 0xd5, 0xe5, 0xb1, 0xc3, 0xf0, 0xff, 0x4e, 0x96, 0x18, 0x6f, 0x70,
-	0x6e, 0xfd, 0xe4, 0xd4, 0xfc, 0xbf, 0x86, 0x6f, 0xce, 0x03, 0xe6, 0xdc, 0x33, 0xf9, 0xcc, 0x3d,
-	0xac, 0xf5, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x39, 0x61, 0xe7, 0x9b, 0x73, 0x02, 0x00, 0x00,
+	// 444 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x94, 0xc1, 0x6b, 0xdb, 0x30,
+	0x14, 0x87, 0xe7, 0xa4, 0x4e, 0xec, 0x17, 0xba, 0x19, 0x31, 0x98, 0x58, 0x2f, 0xa1, 0x30, 0x08,
+	0x83, 0xf9, 0x90, 0x8c, 0xad, 0x6c, 0xa7, 0x74, 0xf4, 0x50, 0x46, 0x1d, 0x70, 0x09, 0x3b, 0x96,
+	0x78, 0x13, 0x65, 0x9e, 0x6d, 0x19, 0xdb, 0x1a, 0xe8, 0x8f, 0x1f, 0x8c, 0x27, 0xcb, 0xb5, 0x6c,
+	0x14, 0xd2, 0x9b, 0xcc, 0xef, 0xfb, 0xf2, 0x9e, 0xf4, 0x1e, 0x81, 0x37, 0x39, 0xaf, 0xd8, 0x43,
+	0xc3, 0xea, 0xe6, 0x81, 0x27, 0x29, 0xfb, 0xd9, 0xd4, 0x61, 0x59, 0xf1, 0x86, 0x93, 0x59, 0x5a,
+	0xf3, 0xa2, 0x4c, 0x2e, 0x2f, 0x60, 0x7e, 0xff, 0x3b, 0x2f, 0x33, 0xb6, 0x21, 0x01, 0x4c, 0x7f,
+	0x89, 0x84, 0x3a, 0x4b, 0x67, 0xe5, 0xc4, 0x78, 0xbc, 0xfc, 0xe7, 0x81, 0x7b, 0x77, 0x28, 0x4b,
+	0x49, 0x42, 0x70, 0x0b, 0x91, 0xe7, 0x92, 0x3a, 0xcb, 0xe9, 0x6a, 0xb1, 0xa6, 0x61, 0xab, 0x87,
+	0x2a, 0x0d, 0x23, 0x8c, 0x6e, 0x8a, 0xa6, 0x92, 0x71, 0x8b, 0x21, 0x5f, 0x37, 0x55, 0x25, 0xe9,
+	0xc4, 0xc6, 0xdf, 0x63, 0xa4, 0x79, 0x85, 0x21, 0xcf, 0x93, 0x34, 0x95, 0x74, 0x6a, 0xe3, 0x77,
+	0x18, 0x69, 0x5e, 0x61, 0xc8, 0x27, 0xe2, 0xf1, 0x51, 0xd2, 0x33, 0x1b, 0x7f, 0x8d, 0x91, 0xe6,
+	0x15, 0xa6, 0x78, 0xce, 0x33, 0x49, 0x5d, 0x2b, 0x8f, 0x51, 0xc7, 0xe3, 0x19, 0x79, 0x56, 0x88,
+	0x5c, 0xd2, 0x99, 0x8d, 0xbf, 0xc1, 0x48, 0xf3, 0x0a, 0x23, 0x9f, 0xc1, 0xab, 0x37, 0xeb, 0xb6,
+	0xc4, 0x5c, 0x29, 0x17, 0xa3, 0x2b, 0xeb, 0xb4, 0xb5, 0x9e, 0x60, 0x25, 0x7e, 0xfa, 0xd8, 0x8a,
+	0x9e, 0x55, 0xd4, 0x69, 0x27, 0xea, 0x4f, 0x14, 0x45, 0x57, 0xd1, 0xb7, 0x89, 0xfb, 0x61, 0x45,
+	0x61, 0x54, 0x14, 0x5d, 0x45, 0xb0, 0x8a, 0xc3, 0x8a, 0x1d, 0xfc, 0xf6, 0x0a, 0xa0, 0x1f, 0x34,
+	0x6e, 0xcb, 0x1f, 0x26, 0xd5, 0xb6, 0x4c, 0x63, 0x3c, 0x92, 0xd7, 0xe0, 0xfe, 0x3d, 0x64, 0x82,
+	0xd1, 0xc9, 0xd2, 0x59, 0xb9, 0x71, 0xfb, 0xf1, 0x65, 0x72, 0xe5, 0xa0, 0xd9, 0x8f, 0xdc, 0x34,
+	0x7d, 0x8b, 0xe9, 0x9b, 0xe6, 0x2d, 0x40, 0x3f, 0x7c, 0xd3, 0x74, 0x5b, 0xf3, 0x9d, 0x69, 0x2e,
+	0xd6, 0xaf, 0xba, 0x9b, 0xe8, 0x9d, 0x1e, 0x35, 0xd1, 0xef, 0xc5, 0xa9, 0xf6, 0xfd, 0xb1, 0xf9,
+	0xf4, 0x20, 0xa6, 0xe9, 0x59, 0x4c, 0x6f, 0xd4, 0x7e, 0xbf, 0x2b, 0x96, 0x8b, 0x0f, 0xda, 0x7f,
+	0xd9, 0xb7, 0x1f, 0x89, 0x9c, 0x55, 0x87, 0xcc, 0xfc, 0xa9, 0xaf, 0x70, 0x3e, 0xd8, 0x21, 0xcb,
+	0x63, 0x1c, 0xef, 0x03, 0x65, 0x73, 0xaa, 0xa7, 0xae, 0x3f, 0x96, 0xf7, 0xc7, 0x2a, 0x9f, 0x3f,
+	0x47, 0x3e, 0x56, 0xf9, 0xec, 0x84, 0xfc, 0xfe, 0x03, 0xcc, 0xf5, 0x4b, 0x90, 0x05, 0xcc, 0xf7,
+	0xd1, 0xf7, 0x68, 0xf7, 0x23, 0x0a, 0x5e, 0x10, 0x80, 0xd9, 0x36, 0xde, 0x5e, 0xdf, 0x7e, 0x0b,
+	0x1c, 0xe2, 0x83, 0x1b, 0xef, 0xee, 0xb6, 0x51, 0x30, 0x49, 0x66, 0xea, 0xaf, 0x6d, 0xf3, 0x3f,
+	0x00, 0x00, 0xff, 0xff, 0xa2, 0x4b, 0xe1, 0x77, 0xf5, 0x04, 0x00, 0x00,
 }
 }

+ 57 - 0
vendor/github.com/gogo/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.proto

@@ -0,0 +1,57 @@
+// Go support for Protocol Buffers - Google's data interchange format
+//
+// Copyright 2015 The Go Authors.  All rights reserved.
+// https://github.com/golang/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package jsonpb;
+
+message Simple3 {
+  double dub = 1;
+}
+
+enum Numeral {
+  UNKNOWN = 0;
+  ARABIC = 1;
+  ROMAN = 2;
+}
+
+message Mappy {
+  map<int64, int32> nummy = 1;
+  map<string, string> strry = 2;
+  map<int32, Simple3> objjy = 3;
+  map<int64, string> buggy = 4;
+  map<bool, bool> booly = 5;
+  map<string, Numeral> enumy = 6;
+  map<int32, bool> s32booly = 7;
+  map<int64, bool> s64booly = 8;
+  map<uint32, bool> u32booly = 9;
+  map<uint64, bool> u64booly = 10;
+}

+ 267 - 69
vendor/github.com/gogo/protobuf/jsonpb/jsonpb_test_proto/test_objects.pb.go

@@ -7,6 +7,13 @@ package jsonpb
 import proto "github.com/gogo/protobuf/proto"
 import proto "github.com/gogo/protobuf/proto"
 import fmt "fmt"
 import fmt "fmt"
 import math "math"
 import math "math"
+import google_protobuf "github.com/gogo/protobuf/types"
+import google_protobuf1 "github.com/gogo/protobuf/types"
+import google_protobuf2 "github.com/gogo/protobuf/types"
+import google_protobuf3 "github.com/gogo/protobuf/types"
+import google_protobuf4 "github.com/gogo/protobuf/types"
+
+// skipping weak import gogoproto "gogoproto"
 
 
 // Reference imports to suppress errors if they are not otherwise used.
 // Reference imports to suppress errors if they are not otherwise used.
 var _ = proto.Marshal
 var _ = proto.Marshal
@@ -63,6 +70,7 @@ type Simple struct {
 	ODouble          *float64 `protobuf:"fixed64,9,opt,name=o_double,json=oDouble" json:"o_double,omitempty"`
 	ODouble          *float64 `protobuf:"fixed64,9,opt,name=o_double,json=oDouble" json:"o_double,omitempty"`
 	OString          *string  `protobuf:"bytes,10,opt,name=o_string,json=oString" json:"o_string,omitempty"`
 	OString          *string  `protobuf:"bytes,10,opt,name=o_string,json=oString" json:"o_string,omitempty"`
 	OBytes           []byte   `protobuf:"bytes,11,opt,name=o_bytes,json=oBytes" json:"o_bytes,omitempty"`
 	OBytes           []byte   `protobuf:"bytes,11,opt,name=o_bytes,json=oBytes" json:"o_bytes,omitempty"`
+	OCastBytes       Bytes    `protobuf:"bytes,12,opt,name=o_cast_bytes,json=oCastBytes,casttype=Bytes" json:"o_cast_bytes,omitempty"`
 	XXX_unrecognized []byte   `json:"-"`
 	XXX_unrecognized []byte   `json:"-"`
 }
 }
 
 
@@ -148,6 +156,13 @@ func (m *Simple) GetOBytes() []byte {
 	return nil
 	return nil
 }
 }
 
 
+func (m *Simple) GetOCastBytes() Bytes {
+	if m != nil {
+		return m.OCastBytes
+	}
+	return nil
+}
+
 // Test message for holding repeated primitives.
 // Test message for holding repeated primitives.
 type Repeats struct {
 type Repeats struct {
 	RBool            []bool    `protobuf:"varint,1,rep,name=r_bool,json=rBool" json:"r_bool,omitempty"`
 	RBool            []bool    `protobuf:"varint,1,rep,name=r_bool,json=rBool" json:"r_bool,omitempty"`
@@ -333,6 +348,8 @@ type MsgWithOneof struct {
 	// Types that are valid to be assigned to Union:
 	// Types that are valid to be assigned to Union:
 	//	*MsgWithOneof_Title
 	//	*MsgWithOneof_Title
 	//	*MsgWithOneof_Salary
 	//	*MsgWithOneof_Salary
+	//	*MsgWithOneof_Country
+	//	*MsgWithOneof_HomeAddress
 	Union            isMsgWithOneof_Union `protobuf_oneof:"union"`
 	Union            isMsgWithOneof_Union `protobuf_oneof:"union"`
 	XXX_unrecognized []byte               `json:"-"`
 	XXX_unrecognized []byte               `json:"-"`
 }
 }
@@ -352,9 +369,17 @@ type MsgWithOneof_Title struct {
 type MsgWithOneof_Salary struct {
 type MsgWithOneof_Salary struct {
 	Salary int64 `protobuf:"varint,2,opt,name=salary,oneof"`
 	Salary int64 `protobuf:"varint,2,opt,name=salary,oneof"`
 }
 }
+type MsgWithOneof_Country struct {
+	Country string `protobuf:"bytes,3,opt,name=Country,oneof"`
+}
+type MsgWithOneof_HomeAddress struct {
+	HomeAddress string `protobuf:"bytes,4,opt,name=home_address,json=homeAddress,oneof"`
+}
 
 
-func (*MsgWithOneof_Title) isMsgWithOneof_Union()  {}
-func (*MsgWithOneof_Salary) isMsgWithOneof_Union() {}
+func (*MsgWithOneof_Title) isMsgWithOneof_Union()       {}
+func (*MsgWithOneof_Salary) isMsgWithOneof_Union()      {}
+func (*MsgWithOneof_Country) isMsgWithOneof_Union()     {}
+func (*MsgWithOneof_HomeAddress) isMsgWithOneof_Union() {}
 
 
 func (m *MsgWithOneof) GetUnion() isMsgWithOneof_Union {
 func (m *MsgWithOneof) GetUnion() isMsgWithOneof_Union {
 	if m != nil {
 	if m != nil {
@@ -377,11 +402,27 @@ func (m *MsgWithOneof) GetSalary() int64 {
 	return 0
 	return 0
 }
 }
 
 
+func (m *MsgWithOneof) GetCountry() string {
+	if x, ok := m.GetUnion().(*MsgWithOneof_Country); ok {
+		return x.Country
+	}
+	return ""
+}
+
+func (m *MsgWithOneof) GetHomeAddress() string {
+	if x, ok := m.GetUnion().(*MsgWithOneof_HomeAddress); ok {
+		return x.HomeAddress
+	}
+	return ""
+}
+
 // XXX_OneofFuncs is for the internal use of the proto package.
 // XXX_OneofFuncs is for the internal use of the proto package.
 func (*MsgWithOneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
 func (*MsgWithOneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
 	return _MsgWithOneof_OneofMarshaler, _MsgWithOneof_OneofUnmarshaler, _MsgWithOneof_OneofSizer, []interface{}{
 	return _MsgWithOneof_OneofMarshaler, _MsgWithOneof_OneofUnmarshaler, _MsgWithOneof_OneofSizer, []interface{}{
 		(*MsgWithOneof_Title)(nil),
 		(*MsgWithOneof_Title)(nil),
 		(*MsgWithOneof_Salary)(nil),
 		(*MsgWithOneof_Salary)(nil),
+		(*MsgWithOneof_Country)(nil),
+		(*MsgWithOneof_HomeAddress)(nil),
 	}
 	}
 }
 }
 
 
@@ -395,6 +436,12 @@ func _MsgWithOneof_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
 	case *MsgWithOneof_Salary:
 	case *MsgWithOneof_Salary:
 		_ = b.EncodeVarint(2<<3 | proto.WireVarint)
 		_ = b.EncodeVarint(2<<3 | proto.WireVarint)
 		_ = b.EncodeVarint(uint64(x.Salary))
 		_ = b.EncodeVarint(uint64(x.Salary))
+	case *MsgWithOneof_Country:
+		_ = b.EncodeVarint(3<<3 | proto.WireBytes)
+		_ = b.EncodeStringBytes(x.Country)
+	case *MsgWithOneof_HomeAddress:
+		_ = b.EncodeVarint(4<<3 | proto.WireBytes)
+		_ = b.EncodeStringBytes(x.HomeAddress)
 	case nil:
 	case nil:
 	default:
 	default:
 		return fmt.Errorf("MsgWithOneof.Union has unexpected type %T", x)
 		return fmt.Errorf("MsgWithOneof.Union has unexpected type %T", x)
@@ -419,6 +466,20 @@ func _MsgWithOneof_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.B
 		x, err := b.DecodeVarint()
 		x, err := b.DecodeVarint()
 		m.Union = &MsgWithOneof_Salary{int64(x)}
 		m.Union = &MsgWithOneof_Salary{int64(x)}
 		return true, err
 		return true, err
+	case 3: // union.Country
+		if wire != proto.WireBytes {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeStringBytes()
+		m.Union = &MsgWithOneof_Country{x}
+		return true, err
+	case 4: // union.home_address
+		if wire != proto.WireBytes {
+			return true, proto.ErrInternalBadWireType
+		}
+		x, err := b.DecodeStringBytes()
+		m.Union = &MsgWithOneof_HomeAddress{x}
+		return true, err
 	default:
 	default:
 		return false, nil
 		return false, nil
 	}
 	}
@@ -435,6 +496,14 @@ func _MsgWithOneof_OneofSizer(msg proto.Message) (n int) {
 	case *MsgWithOneof_Salary:
 	case *MsgWithOneof_Salary:
 		n += proto.SizeVarint(2<<3 | proto.WireVarint)
 		n += proto.SizeVarint(2<<3 | proto.WireVarint)
 		n += proto.SizeVarint(uint64(x.Salary))
 		n += proto.SizeVarint(uint64(x.Salary))
+	case *MsgWithOneof_Country:
+		n += proto.SizeVarint(3<<3 | proto.WireBytes)
+		n += proto.SizeVarint(uint64(len(x.Country)))
+		n += len(x.Country)
+	case *MsgWithOneof_HomeAddress:
+		n += proto.SizeVarint(4<<3 | proto.WireBytes)
+		n += proto.SizeVarint(uint64(len(x.HomeAddress)))
+		n += len(x.HomeAddress)
 	case nil:
 	case nil:
 	default:
 	default:
 		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
 		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
@@ -443,9 +512,9 @@ func _MsgWithOneof_OneofSizer(msg proto.Message) (n int) {
 }
 }
 
 
 type Real struct {
 type Real struct {
-	Value            *float64                  `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
-	XXX_extensions   map[int32]proto.Extension `json:"-"`
-	XXX_unrecognized []byte                    `json:"-"`
+	Value                        *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
+	proto.XXX_InternalExtensions `json:"-"`
+	XXX_unrecognized             []byte `json:"-"`
 }
 }
 
 
 func (m *Real) Reset()                    { *m = Real{} }
 func (m *Real) Reset()                    { *m = Real{} }
@@ -454,18 +523,12 @@ func (*Real) ProtoMessage()               {}
 func (*Real) Descriptor() ([]byte, []int) { return fileDescriptorTestObjects, []int{5} }
 func (*Real) Descriptor() ([]byte, []int) { return fileDescriptorTestObjects, []int{5} }
 
 
 var extRange_Real = []proto.ExtensionRange{
 var extRange_Real = []proto.ExtensionRange{
-	{100, 536870911},
+	{Start: 100, End: 536870911},
 }
 }
 
 
 func (*Real) ExtensionRangeArray() []proto.ExtensionRange {
 func (*Real) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_Real
 	return extRange_Real
 }
 }
-func (m *Real) ExtensionMap() map[int32]proto.Extension {
-	if m.XXX_extensions == nil {
-		m.XXX_extensions = make(map[int32]proto.Extension)
-	}
-	return m.XXX_extensions
-}
 
 
 func (m *Real) GetValue() float64 {
 func (m *Real) GetValue() float64 {
 	if m != nil && m.Value != nil {
 	if m != nil && m.Value != nil {
@@ -475,9 +538,9 @@ func (m *Real) GetValue() float64 {
 }
 }
 
 
 type Complex struct {
 type Complex struct {
-	Imaginary        *float64                  `protobuf:"fixed64,1,opt,name=imaginary" json:"imaginary,omitempty"`
-	XXX_extensions   map[int32]proto.Extension `json:"-"`
-	XXX_unrecognized []byte                    `json:"-"`
+	Imaginary                    *float64 `protobuf:"fixed64,1,opt,name=imaginary" json:"imaginary,omitempty"`
+	proto.XXX_InternalExtensions `json:"-"`
+	XXX_unrecognized             []byte `json:"-"`
 }
 }
 
 
 func (m *Complex) Reset()                    { *m = Complex{} }
 func (m *Complex) Reset()                    { *m = Complex{} }
@@ -486,18 +549,12 @@ func (*Complex) ProtoMessage()               {}
 func (*Complex) Descriptor() ([]byte, []int) { return fileDescriptorTestObjects, []int{6} }
 func (*Complex) Descriptor() ([]byte, []int) { return fileDescriptorTestObjects, []int{6} }
 
 
 var extRange_Complex = []proto.ExtensionRange{
 var extRange_Complex = []proto.ExtensionRange{
-	{100, 536870911},
+	{Start: 100, End: 536870911},
 }
 }
 
 
 func (*Complex) ExtensionRangeArray() []proto.ExtensionRange {
 func (*Complex) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_Complex
 	return extRange_Complex
 }
 }
-func (m *Complex) ExtensionMap() map[int32]proto.Extension {
-	if m.XXX_extensions == nil {
-		m.XXX_extensions = make(map[int32]proto.Extension)
-	}
-	return m.XXX_extensions
-}
 
 
 func (m *Complex) GetImaginary() float64 {
 func (m *Complex) GetImaginary() float64 {
 	if m != nil && m.Imaginary != nil {
 	if m != nil && m.Imaginary != nil {
@@ -512,6 +569,120 @@ var E_Complex_RealExtension = &proto.ExtensionDesc{
 	Field:         123,
 	Field:         123,
 	Name:          "jsonpb.Complex.real_extension",
 	Name:          "jsonpb.Complex.real_extension",
 	Tag:           "bytes,123,opt,name=real_extension,json=realExtension",
 	Tag:           "bytes,123,opt,name=real_extension,json=realExtension",
+	Filename:      "test_objects.proto",
+}
+
+type KnownTypes struct {
+	An               *google_protobuf.Any          `protobuf:"bytes,14,opt,name=an" json:"an,omitempty"`
+	Dur              *google_protobuf1.Duration    `protobuf:"bytes,1,opt,name=dur" json:"dur,omitempty"`
+	St               *google_protobuf2.Struct      `protobuf:"bytes,12,opt,name=st" json:"st,omitempty"`
+	Ts               *google_protobuf3.Timestamp   `protobuf:"bytes,2,opt,name=ts" json:"ts,omitempty"`
+	Dbl              *google_protobuf4.DoubleValue `protobuf:"bytes,3,opt,name=dbl" json:"dbl,omitempty"`
+	Flt              *google_protobuf4.FloatValue  `protobuf:"bytes,4,opt,name=flt" json:"flt,omitempty"`
+	I64              *google_protobuf4.Int64Value  `protobuf:"bytes,5,opt,name=i64" json:"i64,omitempty"`
+	U64              *google_protobuf4.UInt64Value `protobuf:"bytes,6,opt,name=u64" json:"u64,omitempty"`
+	I32              *google_protobuf4.Int32Value  `protobuf:"bytes,7,opt,name=i32" json:"i32,omitempty"`
+	U32              *google_protobuf4.UInt32Value `protobuf:"bytes,8,opt,name=u32" json:"u32,omitempty"`
+	Bool             *google_protobuf4.BoolValue   `protobuf:"bytes,9,opt,name=bool" json:"bool,omitempty"`
+	Str              *google_protobuf4.StringValue `protobuf:"bytes,10,opt,name=str" json:"str,omitempty"`
+	Bytes            *google_protobuf4.BytesValue  `protobuf:"bytes,11,opt,name=bytes" json:"bytes,omitempty"`
+	XXX_unrecognized []byte                        `json:"-"`
+}
+
+func (m *KnownTypes) Reset()                    { *m = KnownTypes{} }
+func (m *KnownTypes) String() string            { return proto.CompactTextString(m) }
+func (*KnownTypes) ProtoMessage()               {}
+func (*KnownTypes) Descriptor() ([]byte, []int) { return fileDescriptorTestObjects, []int{7} }
+
+func (m *KnownTypes) GetAn() *google_protobuf.Any {
+	if m != nil {
+		return m.An
+	}
+	return nil
+}
+
+func (m *KnownTypes) GetDur() *google_protobuf1.Duration {
+	if m != nil {
+		return m.Dur
+	}
+	return nil
+}
+
+func (m *KnownTypes) GetSt() *google_protobuf2.Struct {
+	if m != nil {
+		return m.St
+	}
+	return nil
+}
+
+func (m *KnownTypes) GetTs() *google_protobuf3.Timestamp {
+	if m != nil {
+		return m.Ts
+	}
+	return nil
+}
+
+func (m *KnownTypes) GetDbl() *google_protobuf4.DoubleValue {
+	if m != nil {
+		return m.Dbl
+	}
+	return nil
+}
+
+func (m *KnownTypes) GetFlt() *google_protobuf4.FloatValue {
+	if m != nil {
+		return m.Flt
+	}
+	return nil
+}
+
+func (m *KnownTypes) GetI64() *google_protobuf4.Int64Value {
+	if m != nil {
+		return m.I64
+	}
+	return nil
+}
+
+func (m *KnownTypes) GetU64() *google_protobuf4.UInt64Value {
+	if m != nil {
+		return m.U64
+	}
+	return nil
+}
+
+func (m *KnownTypes) GetI32() *google_protobuf4.Int32Value {
+	if m != nil {
+		return m.I32
+	}
+	return nil
+}
+
+func (m *KnownTypes) GetU32() *google_protobuf4.UInt32Value {
+	if m != nil {
+		return m.U32
+	}
+	return nil
+}
+
+func (m *KnownTypes) GetBool() *google_protobuf4.BoolValue {
+	if m != nil {
+		return m.Bool
+	}
+	return nil
+}
+
+func (m *KnownTypes) GetStr() *google_protobuf4.StringValue {
+	if m != nil {
+		return m.Str
+	}
+	return nil
+}
+
+func (m *KnownTypes) GetBytes() *google_protobuf4.BytesValue {
+	if m != nil {
+		return m.Bytes
+	}
+	return nil
 }
 }
 
 
 var E_Name = &proto.ExtensionDesc{
 var E_Name = &proto.ExtensionDesc{
@@ -520,6 +691,7 @@ var E_Name = &proto.ExtensionDesc{
 	Field:         124,
 	Field:         124,
 	Name:          "jsonpb.name",
 	Name:          "jsonpb.name",
 	Tag:           "bytes,124,opt,name=name",
 	Tag:           "bytes,124,opt,name=name",
+	Filename:      "test_objects.proto",
 }
 }
 
 
 func init() {
 func init() {
@@ -530,57 +702,83 @@ func init() {
 	proto.RegisterType((*MsgWithOneof)(nil), "jsonpb.MsgWithOneof")
 	proto.RegisterType((*MsgWithOneof)(nil), "jsonpb.MsgWithOneof")
 	proto.RegisterType((*Real)(nil), "jsonpb.Real")
 	proto.RegisterType((*Real)(nil), "jsonpb.Real")
 	proto.RegisterType((*Complex)(nil), "jsonpb.Complex")
 	proto.RegisterType((*Complex)(nil), "jsonpb.Complex")
+	proto.RegisterType((*KnownTypes)(nil), "jsonpb.KnownTypes")
 	proto.RegisterEnum("jsonpb.Widget_Color", Widget_Color_name, Widget_Color_value)
 	proto.RegisterEnum("jsonpb.Widget_Color", Widget_Color_name, Widget_Color_value)
 	proto.RegisterExtension(E_Complex_RealExtension)
 	proto.RegisterExtension(E_Complex_RealExtension)
 	proto.RegisterExtension(E_Name)
 	proto.RegisterExtension(E_Name)
 }
 }
 
 
+func init() { proto.RegisterFile("test_objects.proto", fileDescriptorTestObjects) }
+
 var fileDescriptorTestObjects = []byte{
 var fileDescriptorTestObjects = []byte{
-	// 724 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x94, 0x51, 0x4f, 0xd3, 0x5e,
-	0x18, 0xc6, 0x59, 0xcf, 0xba, 0xb6, 0xef, 0x60, 0xff, 0xfd, 0x4f, 0x40, 0x2b, 0x6a, 0x42, 0x16,
-	0x25, 0x4a, 0x74, 0x17, 0x93, 0x10, 0x83, 0xde, 0x38, 0x98, 0x4a, 0x22, 0x98, 0x94, 0x10, 0x2e,
-	0x97, 0x0e, 0xca, 0x2c, 0x76, 0x3d, 0xcb, 0xdb, 0x4e, 0x59, 0xf4, 0xc2, 0x0f, 0xe1, 0x57, 0xd0,
-	0x8f, 0xe0, 0xe7, 0xf3, 0xbc, 0xe7, 0xb4, 0x3d, 0x03, 0x22, 0x37, 0xec, 0xed, 0xf3, 0x3e, 0xcf,
-	0x4e, 0x7f, 0xe7, 0xc9, 0x80, 0xe7, 0x51, 0x96, 0x0f, 0xc5, 0xe8, 0x32, 0x3a, 0xcb, 0xb3, 0xee,
-	0x14, 0x45, 0x2e, 0x78, 0xe3, 0x32, 0x13, 0xe9, 0x74, 0xd4, 0xf9, 0x65, 0x41, 0xe3, 0x38, 0x9e,
-	0x4c, 0x93, 0x88, 0xaf, 0x41, 0x43, 0x0c, 0x47, 0x42, 0x24, 0x7e, 0x6d, 0xa3, 0xf6, 0xc4, 0x0d,
-	0x6c, 0xd1, 0x97, 0x03, 0xbf, 0x0b, 0x8e, 0x18, 0xc6, 0x69, 0xfe, 0xa2, 0xe7, 0x5b, 0xf2, 0xb9,
-	0x1d, 0x34, 0xc4, 0x01, 0x4d, 0x95, 0xb0, 0xb3, 0xed, 0x33, 0x29, 0x30, 0x2d, 0xec, 0x6c, 0xf3,
-	0x7b, 0xe0, 0x8a, 0xe1, 0x4c, 0x5b, 0xea, 0x52, 0x59, 0x09, 0x1c, 0x71, 0xa2, 0x46, 0x23, 0x49,
-	0x93, 0x2d, 0xa5, 0x7a, 0x21, 0x95, 0xae, 0x4c, 0xbb, 0x1a, 0x52, 0xfa, 0x5f, 0x4a, 0xc7, 0x0b,
-	0xae, 0x4c, 0xbb, 0x1c, 0x29, 0xf1, 0x42, 0x92, 0x2e, 0x75, 0x88, 0x8b, 0x44, 0x84, 0xb9, 0xef,
-	0x4a, 0xc5, 0x92, 0x87, 0x78, 0x4b, 0x93, 0xf6, 0x9c, 0x8b, 0xd9, 0x28, 0x89, 0x7c, 0x4f, 0x2a,
-	0x35, 0xe9, 0xd9, 0x57, 0x63, 0x11, 0x97, 0x63, 0x9c, 0x8e, 0x7d, 0x90, 0x92, 0x47, 0x71, 0x6a,
-	0xd4, 0x71, 0xa3, 0xb9, 0x04, 0xe6, 0x37, 0xa5, 0xb2, 0x2c, 0xe3, 0xfa, 0x34, 0x75, 0x7e, 0x5b,
-	0xe0, 0x04, 0xd1, 0x34, 0x0a, 0xf3, 0x8c, 0x40, 0x61, 0x09, 0x8a, 0x11, 0x28, 0x2c, 0x41, 0x61,
-	0x05, 0x8a, 0x11, 0x28, 0xac, 0x40, 0x61, 0x05, 0x8a, 0x11, 0x28, 0xac, 0x40, 0xa1, 0x01, 0xc5,
-	0x08, 0x14, 0x1a, 0x50, 0x68, 0x40, 0x31, 0x02, 0x85, 0x06, 0x14, 0x1a, 0x50, 0x8c, 0x40, 0xe1,
-	0xf1, 0x82, 0xab, 0x02, 0xc5, 0x08, 0x14, 0x1a, 0x50, 0x58, 0x81, 0x62, 0x04, 0x0a, 0x2b, 0x50,
-	0x68, 0x40, 0x31, 0x02, 0x85, 0x06, 0x14, 0x1a, 0x50, 0x8c, 0x40, 0xa1, 0x01, 0x85, 0x15, 0x28,
-	0x46, 0xa0, 0x50, 0x83, 0xfa, 0x23, 0x0b, 0x75, 0x1a, 0x9f, 0x8f, 0xa3, 0x9c, 0x6f, 0x81, 0x7d,
-	0x26, 0x12, 0x81, 0xaa, 0x4f, 0xad, 0xde, 0x6a, 0x57, 0x77, 0xae, 0xab, 0xe5, 0xee, 0x1e, 0x69,
-	0x81, 0x5e, 0xe1, 0xcf, 0x29, 0x4f, 0x6f, 0x13, 0xbc, 0x7f, 0x6d, 0x37, 0x50, 0xfd, 0xe7, 0x9b,
-	0xd0, 0xc8, 0x54, 0x6b, 0xd5, 0x05, 0x36, 0x7b, 0xad, 0x72, 0x5b, 0x77, 0x39, 0x28, 0x54, 0xfe,
-	0x54, 0x03, 0x51, 0x9b, 0x74, 0xce, 0xdb, 0x9b, 0x04, 0xa8, 0x58, 0x75, 0x50, 0x5f, 0xb0, 0xbf,
-	0xaa, 0x32, 0xff, 0x2b, 0x37, 0x8b, 0x7b, 0x0f, 0x4a, 0x9d, 0x3f, 0x03, 0x0f, 0x87, 0xe5, 0xf2,
-	0x9a, 0x8a, 0xbd, 0xb5, 0xec, 0x62, 0xf1, 0xa9, 0xf3, 0x18, 0x6c, 0x7d, 0x68, 0x07, 0x58, 0x30,
-	0xd8, 0x6f, 0x2f, 0x71, 0x0f, 0xec, 0x77, 0xc1, 0x60, 0x70, 0xd4, 0xae, 0x71, 0x17, 0xea, 0xfd,
-	0x0f, 0x27, 0x83, 0xb6, 0xd5, 0xf9, 0x69, 0x41, 0xfd, 0x30, 0x9c, 0x66, 0xfc, 0x15, 0x34, 0x27,
-	0xba, 0x2e, 0xc4, 0x5e, 0x75, 0xac, 0xd9, 0xbb, 0x5f, 0xe6, 0xd3, 0x4a, 0xf7, 0x50, 0xf5, 0x47,
-	0x5e, 0xc5, 0x20, 0xcd, 0x71, 0x1e, 0x78, 0x93, 0x72, 0xe6, 0x6f, 0x60, 0x65, 0xa2, 0xba, 0x59,
-	0xbe, 0xb5, 0xa5, 0xec, 0x0f, 0xaf, 0xdb, 0xa9, 0xaf, 0xfa, 0xb5, 0x75, 0x40, 0x73, 0x62, 0x9e,
-	0xac, 0xbf, 0x86, 0xd6, 0xf5, 0x7c, 0xde, 0x06, 0xf6, 0x39, 0x9a, 0xab, 0x6b, 0x64, 0x01, 0x7d,
-	0xe4, 0xab, 0x60, 0x7f, 0x09, 0x93, 0x59, 0xa4, 0x7e, 0x12, 0xbc, 0x40, 0x0f, 0xbb, 0xd6, 0xcb,
-	0xda, 0xfa, 0x11, 0xb4, 0x6f, 0xc6, 0x2f, 0xfa, 0x5d, 0xed, 0x7f, 0xb4, 0xe8, 0xbf, 0x7d, 0x29,
-	0x26, 0xaf, 0x73, 0x00, 0xcb, 0x87, 0xd9, 0xf8, 0x34, 0xce, 0x3f, 0x7d, 0x4c, 0x23, 0x71, 0xc1,
-	0xef, 0x80, 0x9d, 0xc7, 0xb9, 0x7c, 0x31, 0x4a, 0xf3, 0xde, 0x2f, 0x05, 0x7a, 0xe4, 0xbe, 0x6c,
-	0x44, 0x98, 0x84, 0x38, 0x57, 0x91, 0x4c, 0x0a, 0xc5, 0xdc, 0x77, 0xc0, 0x9e, 0xa5, 0xb1, 0x48,
-	0x3b, 0x9b, 0x50, 0x0f, 0xa2, 0x30, 0x31, 0x87, 0xaf, 0xa9, 0xdf, 0x05, 0x3d, 0x6c, 0xb9, 0xee,
-	0x79, 0xfb, 0x87, 0xfc, 0xb3, 0x3a, 0x5f, 0xc1, 0xd9, 0x13, 0x74, 0x8e, 0x2b, 0xfe, 0x00, 0xbc,
-	0x78, 0x12, 0x8e, 0xe3, 0x94, 0x82, 0xf5, 0xba, 0x79, 0x60, 0x2c, 0xbd, 0x7d, 0x68, 0xa1, 0x8c,
-	0x1e, 0x46, 0x57, 0x79, 0x94, 0x66, 0xf2, 0xcb, 0xf8, 0xb2, 0x29, 0x44, 0x98, 0xf8, 0xdf, 0xae,
-	0x37, 0xaa, 0x88, 0x0f, 0x56, 0xc8, 0x34, 0x28, 0x3d, 0xbb, 0x1b, 0x50, 0x4f, 0xc3, 0x49, 0x74,
-	0xc3, 0xfb, 0x5d, 0x21, 0x56, 0xca, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0e, 0xd7, 0x26, 0x3c,
-	0xcb, 0x05, 0x00, 0x00,
+	// 1098 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x95, 0xdd, 0x72, 0xdb, 0x44,
+	0x14, 0xc7, 0x2b, 0xc9, 0xf2, 0xc7, 0xda, 0x0d, 0x66, 0x27, 0xa5, 0x8a, 0x09, 0x54, 0x63, 0x4a,
+	0x11, 0x2d, 0x75, 0x06, 0xc5, 0xe3, 0x61, 0x0a, 0x37, 0xf9, 0x30, 0x94, 0x81, 0x94, 0x99, 0x4d,
+	0x43, 0xb9, 0xf3, 0xc8, 0xf1, 0xc6, 0x55, 0x91, 0xb5, 0x9e, 0xdd, 0x15, 0xa9, 0x07, 0x2e, 0x72,
+	0xcd, 0x35, 0xcf, 0xc0, 0x23, 0xf0, 0x20, 0x3c, 0x00, 0x57, 0x3c, 0x05, 0x57, 0xcc, 0x39, 0x2b,
+	0x59, 0x89, 0x1d, 0x5f, 0x59, 0xbb, 0xe7, 0x7f, 0xfe, 0x5e, 0xfd, 0xf6, 0xe8, 0x1c, 0x42, 0x35,
+	0x57, 0x7a, 0x24, 0xc6, 0x6f, 0xf8, 0xb9, 0x56, 0xbd, 0xb9, 0x14, 0x5a, 0xd0, 0xea, 0x1b, 0x25,
+	0xd2, 0xf9, 0xb8, 0xb3, 0x33, 0x15, 0x62, 0x9a, 0xf0, 0x3d, 0xdc, 0x1d, 0x67, 0x17, 0x7b, 0x51,
+	0xba, 0x30, 0x92, 0xce, 0x87, 0xab, 0xa1, 0x49, 0x26, 0x23, 0x1d, 0x8b, 0x34, 0x8f, 0xef, 0xae,
+	0xc6, 0x95, 0x96, 0xd9, 0xb9, 0xce, 0xa3, 0x0f, 0x56, 0xa3, 0x3a, 0x9e, 0x71, 0xa5, 0xa3, 0xd9,
+	0x7c, 0x93, 0xfd, 0xa5, 0x8c, 0xe6, 0x73, 0x2e, 0xf3, 0x13, 0x76, 0xb6, 0xa7, 0x62, 0x2a, 0xf0,
+	0x71, 0x0f, 0x9e, 0xcc, 0x6e, 0xf7, 0x6f, 0x9b, 0x54, 0x4f, 0xe3, 0xd9, 0x3c, 0xe1, 0xf4, 0x1e,
+	0xa9, 0x8a, 0xd1, 0x58, 0x88, 0xc4, 0xb3, 0x7c, 0x2b, 0xa8, 0x33, 0x57, 0x1c, 0x0a, 0x91, 0xd0,
+	0xfb, 0xa4, 0x26, 0x46, 0x71, 0xaa, 0xf7, 0x43, 0xcf, 0xf6, 0xad, 0xc0, 0x65, 0x55, 0xf1, 0x2d,
+	0xac, 0x96, 0x81, 0x41, 0xdf, 0x73, 0x7c, 0x2b, 0x70, 0x4c, 0x60, 0xd0, 0xa7, 0x3b, 0xa4, 0x2e,
+	0x46, 0x99, 0x49, 0xa9, 0xf8, 0x56, 0x70, 0x97, 0xd5, 0xc4, 0x19, 0x2e, 0xcb, 0xd0, 0xa0, 0xef,
+	0xb9, 0xbe, 0x15, 0x54, 0xf2, 0x50, 0x91, 0xa5, 0x4c, 0x56, 0xd5, 0xb7, 0x82, 0x77, 0x59, 0x4d,
+	0x9c, 0x5e, 0xcb, 0x52, 0x26, 0xab, 0xe6, 0x5b, 0x01, 0xcd, 0x43, 0x83, 0xbe, 0x39, 0xc4, 0x45,
+	0x22, 0x22, 0xed, 0xd5, 0x7d, 0x2b, 0xb0, 0x59, 0x55, 0x7c, 0x0d, 0x2b, 0x93, 0x33, 0x11, 0xd9,
+	0x38, 0xe1, 0x5e, 0xc3, 0xb7, 0x02, 0x8b, 0xd5, 0xc4, 0x31, 0x2e, 0x73, 0x3b, 0x2d, 0xe3, 0x74,
+	0xea, 0x11, 0xdf, 0x0a, 0x1a, 0x60, 0x87, 0x4b, 0x63, 0x37, 0x5e, 0x68, 0xae, 0xbc, 0xa6, 0x6f,
+	0x05, 0x2d, 0x56, 0x15, 0x87, 0xb0, 0xa2, 0x4f, 0x48, 0x4b, 0x8c, 0xce, 0x23, 0xa5, 0xf3, 0x68,
+	0x0b, 0xa2, 0x87, 0x8d, 0xff, 0xfe, 0x79, 0xe0, 0xa2, 0x80, 0x11, 0x71, 0x14, 0x29, 0x8d, 0xcf,
+	0xdd, 0x3f, 0x6d, 0x52, 0x63, 0x7c, 0xce, 0x23, 0xad, 0x80, 0xaa, 0x2c, 0xa8, 0x3a, 0x40, 0x55,
+	0x16, 0x54, 0xe5, 0x92, 0xaa, 0x03, 0x54, 0xe5, 0x92, 0xaa, 0x5c, 0x52, 0x75, 0x80, 0xaa, 0x5c,
+	0x52, 0x95, 0x25, 0x55, 0x07, 0xa8, 0xca, 0x92, 0xaa, 0x2c, 0xa9, 0x3a, 0x40, 0x55, 0x96, 0x54,
+	0x65, 0x49, 0xd5, 0x01, 0xaa, 0xf2, 0xf4, 0x5a, 0xd6, 0x92, 0xaa, 0x03, 0x54, 0x65, 0x49, 0x55,
+	0x2e, 0xa9, 0x3a, 0x40, 0x55, 0x2e, 0xa9, 0xca, 0x92, 0xaa, 0x03, 0x54, 0x65, 0x49, 0x55, 0x96,
+	0x54, 0x1d, 0xa0, 0x2a, 0x4b, 0xaa, 0x72, 0x49, 0xd5, 0x01, 0xaa, 0xd2, 0x80, 0xfa, 0xcb, 0x26,
+	0xd5, 0x57, 0xf1, 0x64, 0xca, 0x35, 0x7d, 0x4c, 0xdc, 0x73, 0x91, 0x08, 0x89, 0xc5, 0xb7, 0x15,
+	0x6e, 0xf7, 0xcc, 0x07, 0xd5, 0x33, 0xe1, 0xde, 0x11, 0xc4, 0x98, 0x91, 0xd0, 0xa7, 0xe0, 0x67,
+	0xd4, 0x00, 0x6f, 0x93, 0xba, 0x2a, 0xf1, 0x97, 0x3e, 0x22, 0x55, 0x85, 0x25, 0x8e, 0xb7, 0xdd,
+	0x0c, 0xb7, 0x0a, 0xb5, 0x29, 0x7c, 0x96, 0x47, 0xe9, 0xa7, 0x06, 0x08, 0x2a, 0xe1, 0x9c, 0xeb,
+	0x4a, 0x00, 0x94, 0x4b, 0x6b, 0xd2, 0x5c, 0xb0, 0xb7, 0x8d, 0x9e, 0xef, 0x14, 0xca, 0xfc, 0xde,
+	0x59, 0x11, 0xa7, 0x9f, 0x91, 0x86, 0x1c, 0x15, 0xe2, 0x7b, 0x68, 0xbb, 0x26, 0xae, 0xcb, 0xfc,
+	0xa9, 0xfb, 0x31, 0x71, 0xcd, 0xa1, 0x6b, 0xc4, 0x61, 0xc3, 0xe3, 0xf6, 0x1d, 0xda, 0x20, 0xee,
+	0x37, 0x6c, 0x38, 0x7c, 0xd1, 0xb6, 0x68, 0x9d, 0x54, 0x0e, 0xbf, 0x3f, 0x1b, 0xb6, 0xed, 0xee,
+	0x1f, 0x36, 0xa9, 0x9c, 0x44, 0x73, 0x45, 0xbf, 0x24, 0xcd, 0x99, 0x29, 0x17, 0x60, 0x8f, 0x35,
+	0xd6, 0x0c, 0xdf, 0x2f, 0xfc, 0x41, 0xd2, 0x3b, 0xc1, 0xfa, 0x39, 0xd5, 0x72, 0x98, 0x6a, 0xb9,
+	0x60, 0x8d, 0x59, 0xb1, 0xa6, 0x07, 0xe4, 0xee, 0x0c, 0x6b, 0xb3, 0x78, 0x6b, 0x1b, 0xd3, 0x3f,
+	0xb8, 0x99, 0x0e, 0xf5, 0x6a, 0x5e, 0xdb, 0x18, 0x34, 0x67, 0xe5, 0x4e, 0xe7, 0x2b, 0xb2, 0x75,
+	0xd3, 0x9f, 0xb6, 0x89, 0xf3, 0x33, 0x5f, 0xe0, 0x35, 0x3a, 0x0c, 0x1e, 0xe9, 0x36, 0x71, 0x7f,
+	0x89, 0x92, 0x8c, 0x63, 0xff, 0x68, 0x30, 0xb3, 0x78, 0x66, 0x7f, 0x61, 0x75, 0x5e, 0x90, 0xf6,
+	0xaa, 0xfd, 0xf5, 0xfc, 0xba, 0xc9, 0x7f, 0x78, 0x3d, 0x7f, 0xfd, 0x52, 0x4a, 0xbf, 0xee, 0xef,
+	0x16, 0x69, 0x9d, 0xa8, 0xe9, 0xab, 0x58, 0xbf, 0xfe, 0x21, 0xe5, 0xe2, 0x82, 0xbe, 0x47, 0x5c,
+	0x1d, 0xeb, 0x84, 0xa3, 0x5d, 0xe3, 0xf9, 0x1d, 0x66, 0x96, 0xd4, 0x23, 0x55, 0x15, 0x25, 0x91,
+	0x5c, 0xa0, 0xa7, 0xf3, 0xfc, 0x0e, 0xcb, 0xd7, 0xb4, 0x43, 0x6a, 0x47, 0x22, 0x83, 0x93, 0x60,
+	0x57, 0x83, 0x9c, 0x62, 0x83, 0x7e, 0x44, 0x5a, 0xaf, 0xc5, 0x8c, 0x8f, 0xa2, 0xc9, 0x44, 0x72,
+	0xa5, 0xb0, 0xb9, 0x81, 0xa0, 0x09, 0xbb, 0x07, 0x66, 0xf3, 0xb0, 0x46, 0xdc, 0x2c, 0x8d, 0x45,
+	0xda, 0x7d, 0x44, 0x2a, 0x8c, 0x47, 0x49, 0xf9, 0xfa, 0x16, 0xb6, 0x21, 0xb3, 0x78, 0x5c, 0xaf,
+	0x4f, 0xda, 0x57, 0x57, 0x57, 0x57, 0x76, 0xf7, 0x12, 0xfe, 0x11, 0xde, 0xe4, 0x2d, 0xdd, 0x25,
+	0x8d, 0x78, 0x16, 0x4d, 0xe3, 0x14, 0x4e, 0x66, 0xe4, 0xe5, 0x46, 0x99, 0x12, 0x1e, 0x93, 0x2d,
+	0xc9, 0xa3, 0x64, 0xc4, 0xdf, 0x6a, 0x9e, 0xaa, 0x58, 0xa4, 0xb4, 0x55, 0x96, 0x54, 0x94, 0x78,
+	0xbf, 0xde, 0xac, 0xc9, 0xdc, 0x9e, 0xdd, 0x85, 0xa4, 0x61, 0x91, 0xd3, 0xfd, 0xb7, 0x42, 0xc8,
+	0x77, 0xa9, 0xb8, 0x4c, 0x5f, 0x2e, 0xe6, 0x5c, 0xd1, 0x87, 0xc4, 0x8e, 0x52, 0x6f, 0x0b, 0x53,
+	0xb7, 0x7b, 0x66, 0x9a, 0xf4, 0x8a, 0x69, 0xd2, 0x3b, 0x48, 0x17, 0xcc, 0x8e, 0x52, 0xfa, 0x84,
+	0x38, 0x93, 0xcc, 0x7c, 0xa5, 0xcd, 0x70, 0x67, 0x4d, 0x76, 0x9c, 0xcf, 0x34, 0x06, 0x2a, 0xfa,
+	0x09, 0xb1, 0x95, 0xc6, 0x5e, 0xd9, 0x0c, 0xef, 0xaf, 0x69, 0x4f, 0x71, 0xbe, 0x31, 0x5b, 0xc1,
+	0xd7, 0x6f, 0x6b, 0x95, 0xdf, 0x6f, 0x67, 0x4d, 0xf8, 0xb2, 0x18, 0x75, 0xcc, 0xd6, 0x8a, 0xf6,
+	0x88, 0x33, 0x19, 0x27, 0x78, 0x3b, 0xcd, 0x70, 0x77, 0xfd, 0x04, 0xd8, 0x8e, 0x7e, 0x04, 0xc8,
+	0x0c, 0x84, 0xf4, 0x29, 0x71, 0x2e, 0x12, 0x8d, 0x97, 0x05, 0x9f, 0xc6, 0xaa, 0x1e, 0x1b, 0x5b,
+	0x2e, 0xbf, 0x48, 0x34, 0xc8, 0xe3, 0x7c, 0x3a, 0xdd, 0x26, 0xc7, 0x62, 0xcf, 0xe5, 0xf1, 0xa0,
+	0x0f, 0xa7, 0xc9, 0x06, 0x7d, 0x9c, 0x58, 0xb7, 0x9d, 0xe6, 0xec, 0xba, 0x3e, 0x1b, 0xf4, 0xd1,
+	0x7e, 0x3f, 0xc4, 0x31, 0xb6, 0xc1, 0x7e, 0x3f, 0x2c, 0xec, 0xf7, 0x43, 0xb4, 0xdf, 0x0f, 0x71,
+	0xb6, 0x6d, 0xb2, 0x5f, 0xea, 0x33, 0xd4, 0x57, 0x70, 0xd8, 0x34, 0x36, 0xa0, 0x84, 0xaf, 0xcd,
+	0xc8, 0x51, 0x07, 0xfe, 0xd0, 0x37, 0xc8, 0x06, 0x7f, 0xd3, 0xc0, 0x73, 0x7f, 0xa5, 0x25, 0xfd,
+	0x9c, 0xb8, 0xe5, 0x78, 0xbc, 0xed, 0x05, 0xb0, 0xb1, 0x9b, 0x04, 0xa3, 0x7c, 0xe6, 0x93, 0x4a,
+	0x1a, 0xcd, 0xf8, 0x4a, 0x89, 0xfe, 0x86, 0xbd, 0x00, 0x23, 0x3f, 0xb9, 0xff, 0x07, 0x00, 0x00,
+	0xff, 0xff, 0x17, 0x38, 0x3a, 0x54, 0x53, 0x09, 0x00, 0x00,
 }
 }

+ 138 - 0
vendor/github.com/gogo/protobuf/jsonpb/jsonpb_test_proto/test_objects.proto

@@ -0,0 +1,138 @@
+// Go support for Protocol Buffers - Google's data interchange format
+//
+// Copyright 2015 The Go Authors.  All rights reserved.
+// https://github.com/golang/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto2";
+
+import "google/protobuf/any.proto";
+import "google/protobuf/duration.proto";
+import "google/protobuf/struct.proto";
+import "google/protobuf/timestamp.proto";
+import "google/protobuf/wrappers.proto";
+
+package jsonpb;
+
+import weak "gogoproto/gogo.proto";
+
+// Test message for holding primitive types.
+message Simple {
+  optional bool o_bool = 1;
+  optional int32 o_int32 = 2;
+  optional int64 o_int64 = 3;
+  optional uint32 o_uint32 = 4;
+  optional uint64 o_uint64 = 5;
+  optional sint32 o_sint32 = 6;
+  optional sint64 o_sint64 = 7;
+  optional float o_float = 8;
+  optional double o_double = 9;
+  optional string o_string = 10;
+  optional bytes o_bytes = 11;
+  optional bytes o_cast_bytes = 12 [(gogoproto.casttype) = "Bytes"];
+}
+
+// Test message for holding repeated primitives.
+message Repeats {
+  repeated bool r_bool = 1;
+  repeated int32 r_int32 = 2;
+  repeated int64 r_int64 = 3;
+  repeated uint32 r_uint32 = 4;
+  repeated uint64 r_uint64 = 5;
+  repeated sint32 r_sint32 = 6;
+  repeated sint64 r_sint64 = 7;
+  repeated float r_float = 8;
+  repeated double r_double = 9;
+  repeated string r_string = 10;
+  repeated bytes r_bytes = 11;
+}
+
+// Test message for holding enums and nested messages.
+message Widget {
+  enum Color {
+    RED = 0;
+    GREEN = 1;
+    BLUE = 2;
+  };
+  optional Color color = 1;
+  repeated Color r_color = 2;
+
+  optional Simple simple = 10;
+  repeated Simple r_simple = 11;
+
+  optional Repeats repeats = 20;
+  repeated Repeats r_repeats = 21;
+}
+
+message Maps {
+  map<int64, string> m_int64_str = 1;
+  map<bool, Simple> m_bool_simple = 2;
+}
+
+message MsgWithOneof {
+  oneof union {
+    string title = 1;
+    int64 salary = 2;
+    string Country = 3;
+    string home_address = 4;
+  }
+}
+
+message Real {
+  optional double value = 1;
+  extensions 100 to max;
+}
+
+extend Real {
+  optional string name = 124;
+}
+
+message Complex {
+  extend Real {
+    optional Complex real_extension = 123;
+  }
+  optional double imaginary = 1;
+  extensions 100 to max;
+}
+
+message KnownTypes {
+  optional google.protobuf.Any an = 14;
+  optional google.protobuf.Duration dur = 1;
+  optional google.protobuf.Struct st = 12;
+  optional google.protobuf.Timestamp ts = 2;
+
+  optional google.protobuf.DoubleValue dbl = 3;
+  optional google.protobuf.FloatValue flt = 4;
+  optional google.protobuf.Int64Value i64 = 5;
+  optional google.protobuf.UInt64Value u64 = 6;
+  optional google.protobuf.Int32Value i32 = 7;
+  optional google.protobuf.UInt32Value u32 = 8;
+  optional google.protobuf.BoolValue bool = 9;
+  optional google.protobuf.StringValue str = 10;
+  optional google.protobuf.BytesValue bytes = 11;
+}

+ 14 - 8
vendor/github.com/gogo/protobuf/plugin/compare/compare.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
@@ -40,6 +42,7 @@ type plugin struct {
 	fmtPkg      generator.Single
 	fmtPkg      generator.Single
 	bytesPkg    generator.Single
 	bytesPkg    generator.Single
 	sortkeysPkg generator.Single
 	sortkeysPkg generator.Single
+	protoPkg    generator.Single
 }
 }
 
 
 func NewPlugin() *plugin {
 func NewPlugin() *plugin {
@@ -59,6 +62,7 @@ func (p *plugin) Generate(file *generator.FileDescriptor) {
 	p.fmtPkg = p.NewImport("fmt")
 	p.fmtPkg = p.NewImport("fmt")
 	p.bytesPkg = p.NewImport("bytes")
 	p.bytesPkg = p.NewImport("bytes")
 	p.sortkeysPkg = p.NewImport("github.com/gogo/protobuf/sortkeys")
 	p.sortkeysPkg = p.NewImport("github.com/gogo/protobuf/sortkeys")
+	p.protoPkg = p.NewImport("github.com/gogo/protobuf/proto")
 
 
 	for _, msg := range file.Messages() {
 	for _, msg := range file.Messages() {
 		if msg.DescriptorProto.GetOptions().GetMapEntry() {
 		if msg.DescriptorProto.GetOptions().GetMapEntry() {
@@ -431,17 +435,18 @@ func (p *plugin) generateMessage(file *generator.FileDescriptor, message *genera
 		}
 		}
 	}
 	}
 	if message.DescriptorProto.HasExtension() {
 	if message.DescriptorProto.HasExtension() {
-		fieldname := "XXX_extensions"
 		if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) {
 		if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) {
-			p.P(`extkeys := make([]int32, 0, len(this.`, fieldname, `)+len(that1.`, fieldname, `))`)
-			p.P(`for k, _ := range this.`, fieldname, ` {`)
+			p.P(`thismap := `, p.protoPkg.Use(), `.GetUnsafeExtensionsMap(this)`)
+			p.P(`thatmap := `, p.protoPkg.Use(), `.GetUnsafeExtensionsMap(that1)`)
+			p.P(`extkeys := make([]int32, 0, len(thismap)+len(thatmap))`)
+			p.P(`for k, _ := range thismap {`)
 			p.In()
 			p.In()
 			p.P(`extkeys = append(extkeys, k)`)
 			p.P(`extkeys = append(extkeys, k)`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
-			p.P(`for k, _ := range that1.`, fieldname, ` {`)
+			p.P(`for k, _ := range thatmap {`)
 			p.In()
 			p.In()
-			p.P(`if _, ok := this.`, fieldname, `[k]; !ok {`)
+			p.P(`if _, ok := thismap[k]; !ok {`)
 			p.In()
 			p.In()
 			p.P(`extkeys = append(extkeys, k)`)
 			p.P(`extkeys = append(extkeys, k)`)
 			p.Out()
 			p.Out()
@@ -451,9 +456,9 @@ func (p *plugin) generateMessage(file *generator.FileDescriptor, message *genera
 			p.P(p.sortkeysPkg.Use(), `.Int32s(extkeys)`)
 			p.P(p.sortkeysPkg.Use(), `.Int32s(extkeys)`)
 			p.P(`for _, k := range extkeys {`)
 			p.P(`for _, k := range extkeys {`)
 			p.In()
 			p.In()
-			p.P(`if v, ok := this.`, fieldname, `[k]; ok {`)
+			p.P(`if v, ok := thismap[k]; ok {`)
 			p.In()
 			p.In()
-			p.P(`if v2, ok := that1.`, fieldname, `[k]; ok {`)
+			p.P(`if v2, ok := thatmap[k]; ok {`)
 			p.In()
 			p.In()
 			p.P(`if c := v.Compare(&v2); c != 0 {`)
 			p.P(`if c := v.Compare(&v2); c != 0 {`)
 			p.In()
 			p.In()
@@ -475,6 +480,7 @@ func (p *plugin) generateMessage(file *generator.FileDescriptor, message *genera
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 		} else {
 		} else {
+			fieldname := "XXX_extensions"
 			p.P(`if c := `, p.bytesPkg.Use(), `.Compare(this.`, fieldname, `, that1.`, fieldname, `); c != 0 {`)
 			p.P(`if c := `, p.bytesPkg.Use(), `.Compare(this.`, fieldname, `, that1.`, fieldname, `); c != 0 {`)
 			p.In()
 			p.In()
 			p.P(`return c`)
 			p.P(`return c`)

+ 5 - 3
vendor/github.com/gogo/protobuf/plugin/compare/comparetest.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
@@ -64,14 +66,14 @@ func (p *test) Generate(imports generator.PluginImports, file *generator.FileDes
 			p.In()
 			p.In()
 			p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`)
 			p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`)
 			p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`)
 			p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`)
-			p.P(`data, err := `, protoPkg.Use(), `.Marshal(p)`)
+			p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(p)`)
 			p.P(`if err != nil {`)
 			p.P(`if err != nil {`)
 			p.In()
 			p.In()
 			p.P(`panic(err)`)
 			p.P(`panic(err)`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			p.P(`msg := &`, ccTypeName, `{}`)
 			p.P(`msg := &`, ccTypeName, `{}`)
-			p.P(`if err := `, protoPkg.Use(), `.Unmarshal(data, msg); err != nil {`)
+			p.P(`if err := `, protoPkg.Use(), `.Unmarshal(dAtA, msg); err != nil {`)
 			p.In()
 			p.In()
 			p.P(`panic(err)`)
 			p.P(`panic(err)`)
 			p.Out()
 			p.Out()

+ 3 - 1
vendor/github.com/gogo/protobuf/plugin/defaultcheck/defaultcheck.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without

+ 3 - 1
vendor/github.com/gogo/protobuf/plugin/description/description.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without

+ 3 - 1
vendor/github.com/gogo/protobuf/plugin/description/descriptiontest.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without

+ 3 - 1
vendor/github.com/gogo/protobuf/plugin/embedcheck/embedcheck.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without

+ 4 - 2
vendor/github.com/gogo/protobuf/plugin/enumstringer/enumstringer.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
@@ -74,7 +76,7 @@ func (p *enumstringer) Generate(file *generator.FileDescriptor) {
 			continue
 			continue
 		}
 		}
 		if gogoproto.IsGoEnumStringer(file.FileDescriptorProto, enum.EnumDescriptorProto) {
 		if gogoproto.IsGoEnumStringer(file.FileDescriptorProto, enum.EnumDescriptorProto) {
-			panic("old enum string method needs to be disabled, please use gogoproto.old_enum_stringer or gogoproto.old_enum_string_all and set it to false")
+			panic("Go enum stringer conflicts with new enumstringer plugin: please use gogoproto.goproto_enum_stringer or gogoproto.goproto_enum_string_all and set it to false")
 		}
 		}
 		p.atleastOne = true
 		p.atleastOne = true
 		ccTypeName := generator.CamelCaseSlice(enum.TypeName())
 		ccTypeName := generator.CamelCaseSlice(enum.TypeName())

+ 55 - 12
vendor/github.com/gogo/protobuf/plugin/equal/equal.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
@@ -145,12 +147,12 @@ and the following test code:
 	func TestBVerboseEqual(t *testing8.T) {
 	func TestBVerboseEqual(t *testing8.T) {
 		popr := math_rand8.New(math_rand8.NewSource(time8.Now().UnixNano()))
 		popr := math_rand8.New(math_rand8.NewSource(time8.Now().UnixNano()))
 		p := NewPopulatedB(popr, false)
 		p := NewPopulatedB(popr, false)
-		data, err := github_com_gogo_protobuf_proto2.Marshal(p)
+		dAtA, err := github_com_gogo_protobuf_proto2.Marshal(p)
 		if err != nil {
 		if err != nil {
 			panic(err)
 			panic(err)
 		}
 		}
 		msg := &B{}
 		msg := &B{}
-		if err := github_com_gogo_protobuf_proto2.Unmarshal(data, msg); err != nil {
+		if err := github_com_gogo_protobuf_proto2.Unmarshal(dAtA, msg); err != nil {
 			panic(err)
 			panic(err)
 		}
 		}
 		if err := p.VerboseEqual(msg); err != nil {
 		if err := p.VerboseEqual(msg); err != nil {
@@ -173,6 +175,7 @@ type plugin struct {
 	generator.PluginImports
 	generator.PluginImports
 	fmtPkg   generator.Single
 	fmtPkg   generator.Single
 	bytesPkg generator.Single
 	bytesPkg generator.Single
+	protoPkg generator.Single
 }
 }
 
 
 func NewPlugin() *plugin {
 func NewPlugin() *plugin {
@@ -191,6 +194,7 @@ func (p *plugin) Generate(file *generator.FileDescriptor) {
 	p.PluginImports = generator.NewPluginImports(p.Generator)
 	p.PluginImports = generator.NewPluginImports(p.Generator)
 	p.fmtPkg = p.NewImport("fmt")
 	p.fmtPkg = p.NewImport("fmt")
 	p.bytesPkg = p.NewImport("bytes")
 	p.bytesPkg = p.NewImport("bytes")
+	p.protoPkg = p.NewImport("github.com/gogo/protobuf/proto")
 
 
 	for _, msg := range file.Messages() {
 	for _, msg := range file.Messages() {
 		if msg.DescriptorProto.GetOptions().GetMapEntry() {
 		if msg.DescriptorProto.GetOptions().GetMapEntry() {
@@ -302,9 +306,11 @@ func (p *plugin) generateField(file *generator.FileDescriptor, message *generato
 	repeated := field.IsRepeated()
 	repeated := field.IsRepeated()
 	ctype := gogoproto.IsCustomType(field)
 	ctype := gogoproto.IsCustomType(field)
 	nullable := gogoproto.IsNullable(field)
 	nullable := gogoproto.IsNullable(field)
+	isDuration := gogoproto.IsStdDuration(field)
+	isTimestamp := gogoproto.IsStdTime(field)
 	// oneof := field.OneofIndex != nil
 	// oneof := field.OneofIndex != nil
 	if !repeated {
 	if !repeated {
-		if ctype {
+		if ctype || isTimestamp {
 			if nullable {
 			if nullable {
 				p.P(`if that1.`, fieldname, ` == nil {`)
 				p.P(`if that1.`, fieldname, ` == nil {`)
 				p.In()
 				p.In()
@@ -330,6 +336,20 @@ func (p *plugin) generateField(file *generator.FileDescriptor, message *generato
 			}
 			}
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
+		} else if isDuration {
+			if nullable {
+				p.generateNullableField(fieldname, verbose)
+			} else {
+				p.P(`if this.`, fieldname, ` != that1.`, fieldname, `{`)
+			}
+			p.In()
+			if verbose {
+				p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", this.`, fieldname, `, that1.`, fieldname, `)`)
+			} else {
+				p.P(`return false`)
+			}
+			p.Out()
+			p.P(`}`)
 		} else {
 		} else {
 			if field.IsMessage() || p.IsGroup(field) {
 			if field.IsMessage() || p.IsGroup(field) {
 				if nullable {
 				if nullable {
@@ -373,8 +393,20 @@ func (p *plugin) generateField(file *generator.FileDescriptor, message *generato
 		p.P(`}`)
 		p.P(`}`)
 		p.P(`for i := range this.`, fieldname, ` {`)
 		p.P(`for i := range this.`, fieldname, ` {`)
 		p.In()
 		p.In()
-		if ctype {
+		if ctype && !p.IsMap(field) {
 			p.P(`if !this.`, fieldname, `[i].Equal(that1.`, fieldname, `[i]) {`)
 			p.P(`if !this.`, fieldname, `[i].Equal(that1.`, fieldname, `[i]) {`)
+		} else if isTimestamp {
+			if nullable {
+				p.P(`if !this.`, fieldname, `[i].Equal(*that1.`, fieldname, `[i]) {`)
+			} else {
+				p.P(`if !this.`, fieldname, `[i].Equal(that1.`, fieldname, `[i]) {`)
+			}
+		} else if isDuration {
+			if nullable {
+				p.P(`if dthis, dthat := this.`, fieldname, `[i], that1.`, fieldname, `[i]; (dthis != nil && dthat != nil && *dthis != *dthat) || (dthis != nil && dthat == nil) || (dthis == nil && dthat != nil)  {`)
+			} else {
+				p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`)
+			}
 		} else {
 		} else {
 			if p.IsMap(field) {
 			if p.IsMap(field) {
 				m := p.GoMapType(nil, field)
 				m := p.GoMapType(nil, field)
@@ -404,7 +436,15 @@ func (p *plugin) generateField(file *generator.FileDescriptor, message *generato
 						}
 						}
 					}
 					}
 				} else if mapValue.IsBytes() {
 				} else if mapValue.IsBytes() {
-					p.P(`if !`, p.bytesPkg.Use(), `.Equal(this.`, fieldname, `[i], that1.`, fieldname, `[i]) {`)
+					if ctype {
+						if nullable {
+							p.P(`if !this.`, fieldname, `[i].Equal(*that1.`, fieldname, `[i]) { //nullable`)
+						} else {
+							p.P(`if !this.`, fieldname, `[i].Equal(that1.`, fieldname, `[i]) { //not nullable`)
+						}
+					} else {
+						p.P(`if !`, p.bytesPkg.Use(), `.Equal(this.`, fieldname, `[i], that1.`, fieldname, `[i]) {`)
+					}
 				} else if mapValue.IsString() {
 				} else if mapValue.IsString() {
 					p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`)
 					p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`)
 				} else {
 				} else {
@@ -495,16 +535,18 @@ func (p *plugin) generateMessage(file *generator.FileDescriptor, message *genera
 		}
 		}
 	}
 	}
 	if message.DescriptorProto.HasExtension() {
 	if message.DescriptorProto.HasExtension() {
-		fieldname := "XXX_extensions"
 		if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) {
 		if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) {
-			p.P(`for k, v := range this.`, fieldname, ` {`)
+			fieldname := "XXX_InternalExtensions"
+			p.P(`thismap := `, p.protoPkg.Use(), `.GetUnsafeExtensionsMap(this)`)
+			p.P(`thatmap := `, p.protoPkg.Use(), `.GetUnsafeExtensionsMap(that1)`)
+			p.P(`for k, v := range thismap {`)
 			p.In()
 			p.In()
-			p.P(`if v2, ok := that1.`, fieldname, `[k]; ok {`)
+			p.P(`if v2, ok := thatmap[k]; ok {`)
 			p.In()
 			p.In()
 			p.P(`if !v.Equal(&v2) {`)
 			p.P(`if !v.Equal(&v2) {`)
 			p.In()
 			p.In()
 			if verbose {
 			if verbose {
-				p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this[%v](%v) Not Equal that[%v](%v)", k, this.`, fieldname, `[k], k, that1.`, fieldname, `[k])`)
+				p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this[%v](%v) Not Equal that[%v](%v)", k, thismap[k], k, thatmap[k])`)
 			} else {
 			} else {
 				p.P(`return false`)
 				p.P(`return false`)
 			}
 			}
@@ -523,9 +565,9 @@ func (p *plugin) generateMessage(file *generator.FileDescriptor, message *genera
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 
 
-			p.P(`for k, _ := range that1.`, fieldname, ` {`)
+			p.P(`for k, _ := range thatmap {`)
 			p.In()
 			p.In()
-			p.P(`if _, ok := this.`, fieldname, `[k]; !ok {`)
+			p.P(`if _, ok := thismap[k]; !ok {`)
 			p.In()
 			p.In()
 			if verbose {
 			if verbose {
 				p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, `[%v] Not In this", k)`)
 				p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, `[%v] Not In this", k)`)
@@ -537,6 +579,7 @@ func (p *plugin) generateMessage(file *generator.FileDescriptor, message *genera
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 		} else {
 		} else {
+			fieldname := "XXX_extensions"
 			p.P(`if !`, p.bytesPkg.Use(), `.Equal(this.`, fieldname, `, that1.`, fieldname, `) {`)
 			p.P(`if !`, p.bytesPkg.Use(), `.Equal(this.`, fieldname, `, that1.`, fieldname, `) {`)
 			p.In()
 			p.In()
 			if verbose {
 			if verbose {

+ 5 - 3
vendor/github.com/gogo/protobuf/plugin/equal/equaltest.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
@@ -64,14 +66,14 @@ func (p *test) Generate(imports generator.PluginImports, file *generator.FileDes
 			p.In()
 			p.In()
 			p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`)
 			p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`)
 			p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`)
 			p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`)
-			p.P(`data, err := `, protoPkg.Use(), `.Marshal(p)`)
+			p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(p)`)
 			p.P(`if err != nil {`)
 			p.P(`if err != nil {`)
 			p.In()
 			p.In()
 			p.P(`panic(err)`)
 			p.P(`panic(err)`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			p.P(`msg := &`, ccTypeName, `{}`)
 			p.P(`msg := &`, ccTypeName, `{}`)
-			p.P(`if err := `, protoPkg.Use(), `.Unmarshal(data, msg); err != nil {`)
+			p.P(`if err := `, protoPkg.Use(), `.Unmarshal(dAtA, msg); err != nil {`)
 			p.In()
 			p.In()
 			p.P(`panic(err)`)
 			p.P(`panic(err)`)
 			p.Out()
 			p.Out()

+ 3 - 1
vendor/github.com/gogo/protobuf/plugin/face/face.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without

+ 3 - 1
vendor/github.com/gogo/protobuf/plugin/face/facetest.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without

+ 18 - 10
vendor/github.com/gogo/protobuf/plugin/gostring/gostring.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
@@ -106,6 +108,7 @@ type gostring struct {
 	generator.PluginImports
 	generator.PluginImports
 	atleastOne bool
 	atleastOne bool
 	localName  string
 	localName  string
+	overwrite  bool
 }
 }
 
 
 func NewGoString() *gostring {
 func NewGoString() *gostring {
@@ -116,6 +119,10 @@ func (p *gostring) Name() string {
 	return "gostring"
 	return "gostring"
 }
 }
 
 
+func (p *gostring) Overwrite() {
+	p.overwrite = true
+}
+
 func (p *gostring) Init(g *generator.Generator) {
 func (p *gostring) Init(g *generator.Generator) {
 	p.Generator = g
 	p.Generator = g
 }
 }
@@ -139,7 +146,7 @@ func (p *gostring) Generate(file *generator.FileDescriptor) {
 	sortKeysPkg := p.NewImport("github.com/gogo/protobuf/sortkeys")
 	sortKeysPkg := p.NewImport("github.com/gogo/protobuf/sortkeys")
 
 
 	for _, message := range file.Messages() {
 	for _, message := range file.Messages() {
-		if !gogoproto.HasGoString(file.FileDescriptorProto, message.DescriptorProto) {
+		if !p.overwrite && !gogoproto.HasGoString(file.FileDescriptorProto, message.DescriptorProto) {
 			continue
 			continue
 		}
 		}
 		if message.DescriptorProto.GetOptions().GetMapEntry() {
 		if message.DescriptorProto.GetOptions().GetMapEntry() {
@@ -255,15 +262,15 @@ func (p *gostring) Generate(file *generator.FileDescriptor) {
 			}
 			}
 		}
 		}
 		if message.DescriptorProto.HasExtension() {
 		if message.DescriptorProto.HasExtension() {
-			p.P(`if this.XXX_extensions != nil {`)
-			p.In()
 			if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) {
 			if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) {
-				p.P(`s = append(s, "XXX_extensions: " + extensionToGoString`, p.localName, `(this.XXX_extensions) + ",\n")`)
+				p.P(`s = append(s, "XXX_InternalExtensions: " + extensionToGoString`, p.localName, `(this) + ",\n")`)
 			} else {
 			} else {
+				p.P(`if this.XXX_extensions != nil {`)
+				p.In()
 				p.P(`s = append(s, "XXX_extensions: " + `, fmtPkg.Use(), `.Sprintf("%#v", this.XXX_extensions) + ",\n")`)
 				p.P(`s = append(s, "XXX_extensions: " + `, fmtPkg.Use(), `.Sprintf("%#v", this.XXX_extensions) + ",\n")`)
+				p.Out()
+				p.P(`}`)
 			}
 			}
-			p.Out()
-			p.P(`}`)
 		}
 		}
 		if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) {
 		if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) {
 			p.P(`if this.XXX_unrecognized != nil {`)
 			p.P(`if this.XXX_unrecognized != nil {`)
@@ -331,10 +338,11 @@ func (p *gostring) Generate(file *generator.FileDescriptor) {
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
 
 
-	p.P(`func extensionToGoString`, p.localName, `(e map[int32]`, protoPkg.Use(), `.Extension) string {`)
+	p.P(`func extensionToGoString`, p.localName, `(m `, protoPkg.Use(), `.Message) string {`)
 	p.In()
 	p.In()
+	p.P(`e := `, protoPkg.Use(), `.GetUnsafeExtensionsMap(m)`)
 	p.P(`if e == nil { return "nil" }`)
 	p.P(`if e == nil { return "nil" }`)
-	p.P(`s := "map[int32]proto.Extension{"`)
+	p.P(`s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"`)
 	p.P(`keys := make([]int, 0, len(e))`)
 	p.P(`keys := make([]int, 0, len(e))`)
 	p.P(`for k := range e {`)
 	p.P(`for k := range e {`)
 	p.In()
 	p.In()
@@ -348,7 +356,7 @@ func (p *gostring) Generate(file *generator.FileDescriptor) {
 	p.P(`ss = append(ss, `, strconvPkg.Use(), `.Itoa(k) + ": " + e[int32(k)].GoString())`)
 	p.P(`ss = append(ss, `, strconvPkg.Use(), `.Itoa(k) + ": " + e[int32(k)].GoString())`)
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
-	p.P(`s+=`, stringsPkg.Use(), `.Join(ss, ",") + "}"`)
+	p.P(`s+=`, stringsPkg.Use(), `.Join(ss, ",") + "})"`)
 	p.P(`return s`)
 	p.P(`return s`)
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)

+ 3 - 1
vendor/github.com/gogo/protobuf/plugin/gostring/gostringtest.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without

+ 225 - 125
vendor/github.com/gogo/protobuf/plugin/marshalto/marshalto.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
@@ -73,35 +75,35 @@ message B {
 
 
 given to the marshalto plugin, will generate the following code:
 given to the marshalto plugin, will generate the following code:
 
 
-  func (m *B) Marshal() (data []byte, err error) {
+  func (m *B) Marshal() (dAtA []byte, err error) {
 	size := m.Size()
 	size := m.Size()
-	data = make([]byte, size)
-	n, err := m.MarshalTo(data)
+	dAtA = make([]byte, size)
+	n, err := m.MarshalTo(dAtA)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	return data[:n], nil
+	return dAtA[:n], nil
   }
   }
 
 
-  func (m *B) MarshalTo(data []byte) (int, error) {
+  func (m *B) MarshalTo(dAtA []byte) (int, error) {
 	var i int
 	var i int
 	_ = i
 	_ = i
 	var l int
 	var l int
 	_ = l
 	_ = l
-	data[i] = 0xa
+	dAtA[i] = 0xa
 	i++
 	i++
-	i = encodeVarintExample(data, i, uint64(m.A.Size()))
-	n2, err := m.A.MarshalTo(data[i:])
+	i = encodeVarintExample(dAtA, i, uint64(m.A.Size()))
+	n2, err := m.A.MarshalTo(dAtA[i:])
 	if err != nil {
 	if err != nil {
 		return 0, err
 		return 0, err
 	}
 	}
 	i += n2
 	i += n2
 	if len(m.G) > 0 {
 	if len(m.G) > 0 {
 		for _, msg := range m.G {
 		for _, msg := range m.G {
-			data[i] = 0x12
+			dAtA[i] = 0x12
 			i++
 			i++
-			i = encodeVarintExample(data, i, uint64(msg.Size()))
-			n, err := msg.MarshalTo(data[i:])
+			i = encodeVarintExample(dAtA, i, uint64(msg.Size()))
+			n, err := msg.MarshalTo(dAtA[i:])
 			if err != nil {
 			if err != nil {
 				return 0, err
 				return 0, err
 			}
 			}
@@ -109,7 +111,7 @@ given to the marshalto plugin, will generate the following code:
 		}
 		}
 	}
 	}
 	if m.XXX_unrecognized != nil {
 	if m.XXX_unrecognized != nil {
-		i += copy(data[i:], m.XXX_unrecognized)
+		i += copy(dAtA[i:], m.XXX_unrecognized)
 	}
 	}
 	return i, nil
 	return i, nil
   }
   }
@@ -175,6 +177,7 @@ type marshalto struct {
 	protoPkg    generator.Single
 	protoPkg    generator.Single
 	sortKeysPkg generator.Single
 	sortKeysPkg generator.Single
 	mathPkg     generator.Single
 	mathPkg     generator.Single
+	typesPkg    generator.Single
 	localName   string
 	localName   string
 	unsafe      bool
 	unsafe      bool
 }
 }
@@ -199,66 +202,66 @@ func (p *marshalto) Init(g *generator.Generator) {
 }
 }
 
 
 func (p *marshalto) callFixed64(varName ...string) {
 func (p *marshalto) callFixed64(varName ...string) {
-	p.P(`i = encodeFixed64`, p.localName, `(data, i, uint64(`, strings.Join(varName, ""), `))`)
+	p.P(`i = encodeFixed64`, p.localName, `(dAtA, i, uint64(`, strings.Join(varName, ""), `))`)
 }
 }
 
 
 func (p *marshalto) callFixed32(varName ...string) {
 func (p *marshalto) callFixed32(varName ...string) {
-	p.P(`i = encodeFixed32`, p.localName, `(data, i, uint32(`, strings.Join(varName, ""), `))`)
+	p.P(`i = encodeFixed32`, p.localName, `(dAtA, i, uint32(`, strings.Join(varName, ""), `))`)
 }
 }
 
 
 func (p *marshalto) callVarint(varName ...string) {
 func (p *marshalto) callVarint(varName ...string) {
-	p.P(`i = encodeVarint`, p.localName, `(data, i, uint64(`, strings.Join(varName, ""), `))`)
+	p.P(`i = encodeVarint`, p.localName, `(dAtA, i, uint64(`, strings.Join(varName, ""), `))`)
 }
 }
 
 
 func (p *marshalto) encodeVarint(varName string) {
 func (p *marshalto) encodeVarint(varName string) {
 	p.P(`for `, varName, ` >= 1<<7 {`)
 	p.P(`for `, varName, ` >= 1<<7 {`)
 	p.In()
 	p.In()
-	p.P(`data[i] = uint8(uint64(`, varName, `)&0x7f|0x80)`)
+	p.P(`dAtA[i] = uint8(uint64(`, varName, `)&0x7f|0x80)`)
 	p.P(varName, ` >>= 7`)
 	p.P(varName, ` >>= 7`)
 	p.P(`i++`)
 	p.P(`i++`)
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
-	p.P(`data[i] = uint8(`, varName, `)`)
+	p.P(`dAtA[i] = uint8(`, varName, `)`)
 	p.P(`i++`)
 	p.P(`i++`)
 }
 }
 
 
 func (p *marshalto) encodeFixed64(varName string) {
 func (p *marshalto) encodeFixed64(varName string) {
-	p.P(`data[i] = uint8(`, varName, `)`)
+	p.P(`dAtA[i] = uint8(`, varName, `)`)
 	p.P(`i++`)
 	p.P(`i++`)
-	p.P(`data[i] = uint8(`, varName, ` >> 8)`)
+	p.P(`dAtA[i] = uint8(`, varName, ` >> 8)`)
 	p.P(`i++`)
 	p.P(`i++`)
-	p.P(`data[i] = uint8(`, varName, ` >> 16)`)
+	p.P(`dAtA[i] = uint8(`, varName, ` >> 16)`)
 	p.P(`i++`)
 	p.P(`i++`)
-	p.P(`data[i] = uint8(`, varName, ` >> 24)`)
+	p.P(`dAtA[i] = uint8(`, varName, ` >> 24)`)
 	p.P(`i++`)
 	p.P(`i++`)
-	p.P(`data[i] = uint8(`, varName, ` >> 32)`)
+	p.P(`dAtA[i] = uint8(`, varName, ` >> 32)`)
 	p.P(`i++`)
 	p.P(`i++`)
-	p.P(`data[i] = uint8(`, varName, ` >> 40)`)
+	p.P(`dAtA[i] = uint8(`, varName, ` >> 40)`)
 	p.P(`i++`)
 	p.P(`i++`)
-	p.P(`data[i] = uint8(`, varName, ` >> 48)`)
+	p.P(`dAtA[i] = uint8(`, varName, ` >> 48)`)
 	p.P(`i++`)
 	p.P(`i++`)
-	p.P(`data[i] = uint8(`, varName, ` >> 56)`)
+	p.P(`dAtA[i] = uint8(`, varName, ` >> 56)`)
 	p.P(`i++`)
 	p.P(`i++`)
 }
 }
 
 
 func (p *marshalto) unsafeFixed64(varName string, someType string) {
 func (p *marshalto) unsafeFixed64(varName string, someType string) {
-	p.P(`*(*`, someType, `)(`, p.unsafePkg.Use(), `.Pointer(&data[i])) = `, varName)
+	p.P(`*(*`, someType, `)(`, p.unsafePkg.Use(), `.Pointer(&dAtA[i])) = `, varName)
 	p.P(`i+=8`)
 	p.P(`i+=8`)
 }
 }
 
 
 func (p *marshalto) encodeFixed32(varName string) {
 func (p *marshalto) encodeFixed32(varName string) {
-	p.P(`data[i] = uint8(`, varName, `)`)
+	p.P(`dAtA[i] = uint8(`, varName, `)`)
 	p.P(`i++`)
 	p.P(`i++`)
-	p.P(`data[i] = uint8(`, varName, ` >> 8)`)
+	p.P(`dAtA[i] = uint8(`, varName, ` >> 8)`)
 	p.P(`i++`)
 	p.P(`i++`)
-	p.P(`data[i] = uint8(`, varName, ` >> 16)`)
+	p.P(`dAtA[i] = uint8(`, varName, ` >> 16)`)
 	p.P(`i++`)
 	p.P(`i++`)
-	p.P(`data[i] = uint8(`, varName, ` >> 24)`)
+	p.P(`dAtA[i] = uint8(`, varName, ` >> 24)`)
 	p.P(`i++`)
 	p.P(`i++`)
 }
 }
 
 
 func (p *marshalto) unsafeFixed32(varName string, someType string) {
 func (p *marshalto) unsafeFixed32(varName string, someType string) {
-	p.P(`*(*`, someType, `)(`, p.unsafePkg.Use(), `.Pointer(&data[i])) = `, varName)
+	p.P(`*(*`, someType, `)(`, p.unsafePkg.Use(), `.Pointer(&dAtA[i])) = `, varName)
 	p.P(`i+=4`)
 	p.P(`i+=4`)
 }
 }
 
 
@@ -272,7 +275,7 @@ func (p *marshalto) encodeKey(fieldNumber int32, wireType int) {
 	}
 	}
 	keybuf = append(keybuf, uint8(x))
 	keybuf = append(keybuf, uint8(x))
 	for _, b := range keybuf {
 	for _, b := range keybuf {
-		p.P(`data[i] = `, fmt.Sprintf("%#v", b))
+		p.P(`dAtA[i] = `, fmt.Sprintf("%#v", b))
 		p.P(`i++`)
 		p.P(`i++`)
 	}
 	}
 }
 }
@@ -307,8 +310,8 @@ func wireToType(wire string) int {
 	panic("unreachable")
 	panic("unreachable")
 }
 }
 
 
-func (p *marshalto) mapField(numGen NumGen, fieldTyp descriptor.FieldDescriptorProto_Type, varName string, protoSizer bool) {
-	switch fieldTyp {
+func (p *marshalto) mapField(numGen NumGen, field *descriptor.FieldDescriptorProto, kvField *descriptor.FieldDescriptorProto, varName string, protoSizer bool) {
+	switch kvField.GetType() {
 	case descriptor.FieldDescriptorProto_TYPE_DOUBLE:
 	case descriptor.FieldDescriptorProto_TYPE_DOUBLE:
 		p.callFixed64(p.mathPkg.Use(), `.Float64bits(float64(`, varName, `))`)
 		p.callFixed64(p.mathPkg.Use(), `.Float64bits(float64(`, varName, `))`)
 	case descriptor.FieldDescriptorProto_TYPE_FLOAT:
 	case descriptor.FieldDescriptorProto_TYPE_FLOAT:
@@ -328,29 +331,47 @@ func (p *marshalto) mapField(numGen NumGen, fieldTyp descriptor.FieldDescriptorP
 	case descriptor.FieldDescriptorProto_TYPE_BOOL:
 	case descriptor.FieldDescriptorProto_TYPE_BOOL:
 		p.P(`if `, varName, ` {`)
 		p.P(`if `, varName, ` {`)
 		p.In()
 		p.In()
-		p.P(`data[i] = 1`)
+		p.P(`dAtA[i] = 1`)
 		p.Out()
 		p.Out()
 		p.P(`} else {`)
 		p.P(`} else {`)
 		p.In()
 		p.In()
-		p.P(`data[i] = 0`)
+		p.P(`dAtA[i] = 0`)
 		p.Out()
 		p.Out()
 		p.P(`}`)
 		p.P(`}`)
 		p.P(`i++`)
 		p.P(`i++`)
 	case descriptor.FieldDescriptorProto_TYPE_STRING,
 	case descriptor.FieldDescriptorProto_TYPE_STRING,
 		descriptor.FieldDescriptorProto_TYPE_BYTES:
 		descriptor.FieldDescriptorProto_TYPE_BYTES:
-		p.callVarint(`len(`, varName, `)`)
-		p.P(`i+=copy(data[i:], `, varName, `)`)
+		if gogoproto.IsCustomType(field) && kvField.IsBytes() {
+			p.callVarint(varName, `.Size()`)
+			p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`)
+			p.P(`if err != nil {`)
+			p.In()
+			p.P(`return 0, err`)
+			p.Out()
+			p.P(`}`)
+			p.P(`i+=n`, numGen.Current())
+		} else {
+			p.callVarint(`len(`, varName, `)`)
+			p.P(`i+=copy(dAtA[i:], `, varName, `)`)
+		}
 	case descriptor.FieldDescriptorProto_TYPE_SINT32:
 	case descriptor.FieldDescriptorProto_TYPE_SINT32:
 		p.callVarint(`(uint32(`, varName, `) << 1) ^ uint32((`, varName, ` >> 31))`)
 		p.callVarint(`(uint32(`, varName, `) << 1) ^ uint32((`, varName, ` >> 31))`)
 	case descriptor.FieldDescriptorProto_TYPE_SINT64:
 	case descriptor.FieldDescriptorProto_TYPE_SINT64:
 		p.callVarint(`(uint64(`, varName, `) << 1) ^ uint64((`, varName, ` >> 63))`)
 		p.callVarint(`(uint64(`, varName, `) << 1) ^ uint64((`, varName, ` >> 63))`)
 	case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
 	case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
-		if protoSizer {
+		if gogoproto.IsStdTime(field) {
+			p.callVarint(p.typesPkg.Use(), `.SizeOfStdTime(*`, varName, `)`)
+			p.P(`n`, numGen.Next(), `, err := `, p.typesPkg.Use(), `.StdTimeMarshalTo(*`, varName, `, dAtA[i:])`)
+		} else if gogoproto.IsStdDuration(field) {
+			p.callVarint(p.typesPkg.Use(), `.SizeOfStdDuration(*`, varName, `)`)
+			p.P(`n`, numGen.Next(), `, err := `, p.typesPkg.Use(), `.StdDurationMarshalTo(*`, varName, `, dAtA[i:])`)
+		} else if protoSizer {
 			p.callVarint(varName, `.ProtoSize()`)
 			p.callVarint(varName, `.ProtoSize()`)
+			p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`)
 		} else {
 		} else {
 			p.callVarint(varName, `.Size()`)
 			p.callVarint(varName, `.Size()`)
+			p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`)
 		}
 		}
-		p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(data[i:])`)
 		p.P(`if err != nil {`)
 		p.P(`if err != nil {`)
 		p.In()
 		p.In()
 		p.P(`return 0, err`)
 		p.P(`return 0, err`)
@@ -399,7 +420,7 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 		p.P(`if m.`, fieldname, ` != nil {`)
 		p.P(`if m.`, fieldname, ` != nil {`)
 		p.In()
 		p.In()
 	}
 	}
-	packed := field.IsPacked()
+	packed := field.IsPacked() || (proto3 && field.IsPacked3())
 	wireType := field.WireType()
 	wireType := field.WireType()
 	fieldNumber := field.GetNumber()
 	fieldNumber := field.GetNumber()
 	if packed {
 	if packed {
@@ -541,7 +562,7 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 		descriptor.FieldDescriptorProto_TYPE_ENUM:
 		descriptor.FieldDescriptorProto_TYPE_ENUM:
 		if packed {
 		if packed {
 			jvar := "j" + numGen.Next()
 			jvar := "j" + numGen.Next()
-			p.P(`data`, numGen.Next(), ` := make([]byte, len(m.`, fieldname, `)*10)`)
+			p.P(`dAtA`, numGen.Next(), ` := make([]byte, len(m.`, fieldname, `)*10)`)
 			p.P(`var `, jvar, ` int`)
 			p.P(`var `, jvar, ` int`)
 			if *field.Type == descriptor.FieldDescriptorProto_TYPE_INT64 ||
 			if *field.Type == descriptor.FieldDescriptorProto_TYPE_INT64 ||
 				*field.Type == descriptor.FieldDescriptorProto_TYPE_INT32 {
 				*field.Type == descriptor.FieldDescriptorProto_TYPE_INT32 {
@@ -554,18 +575,18 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 			}
 			}
 			p.P(`for num >= 1<<7 {`)
 			p.P(`for num >= 1<<7 {`)
 			p.In()
 			p.In()
-			p.P(`data`, numGen.Current(), `[`, jvar, `] = uint8(uint64(num)&0x7f|0x80)`)
+			p.P(`dAtA`, numGen.Current(), `[`, jvar, `] = uint8(uint64(num)&0x7f|0x80)`)
 			p.P(`num >>= 7`)
 			p.P(`num >>= 7`)
 			p.P(jvar, `++`)
 			p.P(jvar, `++`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
-			p.P(`data`, numGen.Current(), `[`, jvar, `] = uint8(num)`)
+			p.P(`dAtA`, numGen.Current(), `[`, jvar, `] = uint8(num)`)
 			p.P(jvar, `++`)
 			p.P(jvar, `++`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			p.encodeKey(fieldNumber, wireType)
 			p.encodeKey(fieldNumber, wireType)
 			p.callVarint(jvar)
 			p.callVarint(jvar)
-			p.P(`i += copy(data[i:], data`, numGen.Current(), `[:`, jvar, `])`)
+			p.P(`i += copy(dAtA[i:], dAtA`, numGen.Current(), `[:`, jvar, `])`)
 		} else if repeated {
 		} else if repeated {
 			p.P(`for _, num := range m.`, fieldname, ` {`)
 			p.P(`for _, num := range m.`, fieldname, ` {`)
 			p.In()
 			p.In()
@@ -729,11 +750,11 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 			p.In()
 			p.In()
 			p.P(`if b {`)
 			p.P(`if b {`)
 			p.In()
 			p.In()
-			p.P(`data[i] = 1`)
+			p.P(`dAtA[i] = 1`)
 			p.Out()
 			p.Out()
 			p.P(`} else {`)
 			p.P(`} else {`)
 			p.In()
 			p.In()
-			p.P(`data[i] = 0`)
+			p.P(`dAtA[i] = 0`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			p.P(`i++`)
 			p.P(`i++`)
@@ -745,11 +766,11 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 			p.encodeKey(fieldNumber, wireType)
 			p.encodeKey(fieldNumber, wireType)
 			p.P(`if b {`)
 			p.P(`if b {`)
 			p.In()
 			p.In()
-			p.P(`data[i] = 1`)
+			p.P(`dAtA[i] = 1`)
 			p.Out()
 			p.Out()
 			p.P(`} else {`)
 			p.P(`} else {`)
 			p.In()
 			p.In()
-			p.P(`data[i] = 0`)
+			p.P(`dAtA[i] = 0`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			p.P(`i++`)
 			p.P(`i++`)
@@ -761,11 +782,11 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 			p.encodeKey(fieldNumber, wireType)
 			p.encodeKey(fieldNumber, wireType)
 			p.P(`if m.`, fieldname, ` {`)
 			p.P(`if m.`, fieldname, ` {`)
 			p.In()
 			p.In()
-			p.P(`data[i] = 1`)
+			p.P(`dAtA[i] = 1`)
 			p.Out()
 			p.Out()
 			p.P(`} else {`)
 			p.P(`} else {`)
 			p.In()
 			p.In()
-			p.P(`data[i] = 0`)
+			p.P(`dAtA[i] = 0`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			p.P(`i++`)
 			p.P(`i++`)
@@ -775,11 +796,11 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 			p.encodeKey(fieldNumber, wireType)
 			p.encodeKey(fieldNumber, wireType)
 			p.P(`if m.`, fieldname, ` {`)
 			p.P(`if m.`, fieldname, ` {`)
 			p.In()
 			p.In()
-			p.P(`data[i] = 1`)
+			p.P(`dAtA[i] = 1`)
 			p.Out()
 			p.Out()
 			p.P(`} else {`)
 			p.P(`} else {`)
 			p.In()
 			p.In()
-			p.P(`data[i] = 0`)
+			p.P(`dAtA[i] = 0`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			p.P(`i++`)
 			p.P(`i++`)
@@ -787,11 +808,11 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 			p.encodeKey(fieldNumber, wireType)
 			p.encodeKey(fieldNumber, wireType)
 			p.P(`if *m.`, fieldname, ` {`)
 			p.P(`if *m.`, fieldname, ` {`)
 			p.In()
 			p.In()
-			p.P(`data[i] = 1`)
+			p.P(`dAtA[i] = 1`)
 			p.Out()
 			p.Out()
 			p.P(`} else {`)
 			p.P(`} else {`)
 			p.In()
 			p.In()
-			p.P(`data[i] = 0`)
+			p.P(`dAtA[i] = 0`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			p.P(`i++`)
 			p.P(`i++`)
@@ -803,7 +824,7 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 			p.encodeKey(fieldNumber, wireType)
 			p.encodeKey(fieldNumber, wireType)
 			p.P(`l = len(s)`)
 			p.P(`l = len(s)`)
 			p.encodeVarint("l")
 			p.encodeVarint("l")
-			p.P(`i+=copy(data[i:], s)`)
+			p.P(`i+=copy(dAtA[i:], s)`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 		} else if proto3 {
 		} else if proto3 {
@@ -811,17 +832,17 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 			p.In()
 			p.In()
 			p.encodeKey(fieldNumber, wireType)
 			p.encodeKey(fieldNumber, wireType)
 			p.callVarint(`len(m.`, fieldname, `)`)
 			p.callVarint(`len(m.`, fieldname, `)`)
-			p.P(`i+=copy(data[i:], m.`, fieldname, `)`)
+			p.P(`i+=copy(dAtA[i:], m.`, fieldname, `)`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 		} else if !nullable {
 		} else if !nullable {
 			p.encodeKey(fieldNumber, wireType)
 			p.encodeKey(fieldNumber, wireType)
 			p.callVarint(`len(m.`, fieldname, `)`)
 			p.callVarint(`len(m.`, fieldname, `)`)
-			p.P(`i+=copy(data[i:], m.`, fieldname, `)`)
+			p.P(`i+=copy(dAtA[i:], m.`, fieldname, `)`)
 		} else {
 		} else {
 			p.encodeKey(fieldNumber, wireType)
 			p.encodeKey(fieldNumber, wireType)
 			p.callVarint(`len(*m.`, fieldname, `)`)
 			p.callVarint(`len(*m.`, fieldname, `)`)
-			p.P(`i+=copy(data[i:], *m.`, fieldname, `)`)
+			p.P(`i+=copy(dAtA[i:], *m.`, fieldname, `)`)
 		}
 		}
 	case descriptor.FieldDescriptorProto_TYPE_GROUP:
 	case descriptor.FieldDescriptorProto_TYPE_GROUP:
 		panic(fmt.Errorf("marshaler does not support group %v", fieldname))
 		panic(fmt.Errorf("marshaler does not support group %v", fieldname))
@@ -885,39 +906,65 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 				p.P(`v := m.`, fieldname, `[k]`)
 				p.P(`v := m.`, fieldname, `[k]`)
 			}
 			}
 			accessor := `v`
 			accessor := `v`
-			sum = append(sum, strconv.Itoa(valueKeySize))
 			switch m.ValueField.GetType() {
 			switch m.ValueField.GetType() {
 			case descriptor.FieldDescriptorProto_TYPE_DOUBLE,
 			case descriptor.FieldDescriptorProto_TYPE_DOUBLE,
 				descriptor.FieldDescriptorProto_TYPE_FIXED64,
 				descriptor.FieldDescriptorProto_TYPE_FIXED64,
 				descriptor.FieldDescriptorProto_TYPE_SFIXED64:
 				descriptor.FieldDescriptorProto_TYPE_SFIXED64:
+				sum = append(sum, strconv.Itoa(valueKeySize))
 				sum = append(sum, strconv.Itoa(8))
 				sum = append(sum, strconv.Itoa(8))
 			case descriptor.FieldDescriptorProto_TYPE_FLOAT,
 			case descriptor.FieldDescriptorProto_TYPE_FLOAT,
 				descriptor.FieldDescriptorProto_TYPE_FIXED32,
 				descriptor.FieldDescriptorProto_TYPE_FIXED32,
 				descriptor.FieldDescriptorProto_TYPE_SFIXED32:
 				descriptor.FieldDescriptorProto_TYPE_SFIXED32:
+				sum = append(sum, strconv.Itoa(valueKeySize))
 				sum = append(sum, strconv.Itoa(4))
 				sum = append(sum, strconv.Itoa(4))
 			case descriptor.FieldDescriptorProto_TYPE_INT64,
 			case descriptor.FieldDescriptorProto_TYPE_INT64,
 				descriptor.FieldDescriptorProto_TYPE_UINT64,
 				descriptor.FieldDescriptorProto_TYPE_UINT64,
 				descriptor.FieldDescriptorProto_TYPE_UINT32,
 				descriptor.FieldDescriptorProto_TYPE_UINT32,
 				descriptor.FieldDescriptorProto_TYPE_ENUM,
 				descriptor.FieldDescriptorProto_TYPE_ENUM,
 				descriptor.FieldDescriptorProto_TYPE_INT32:
 				descriptor.FieldDescriptorProto_TYPE_INT32:
+				sum = append(sum, strconv.Itoa(valueKeySize))
 				sum = append(sum, `sov`+p.localName+`(uint64(v))`)
 				sum = append(sum, `sov`+p.localName+`(uint64(v))`)
 			case descriptor.FieldDescriptorProto_TYPE_BOOL:
 			case descriptor.FieldDescriptorProto_TYPE_BOOL:
+				sum = append(sum, strconv.Itoa(valueKeySize))
 				sum = append(sum, `1`)
 				sum = append(sum, `1`)
-			case descriptor.FieldDescriptorProto_TYPE_STRING,
-				descriptor.FieldDescriptorProto_TYPE_BYTES:
+			case descriptor.FieldDescriptorProto_TYPE_STRING:
+				sum = append(sum, strconv.Itoa(valueKeySize))
 				sum = append(sum, `len(v)+sov`+p.localName+`(uint64(len(v)))`)
 				sum = append(sum, `len(v)+sov`+p.localName+`(uint64(len(v)))`)
-			case descriptor.FieldDescriptorProto_TYPE_SINT32,
-				descriptor.FieldDescriptorProto_TYPE_SINT64:
-				sum = append(sum, `soz`+p.localName+`(uint64(v))`)
-			case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
-				if nullable {
-					p.P(`if v == nil {`)
+			case descriptor.FieldDescriptorProto_TYPE_BYTES:
+				if gogoproto.IsCustomType(field) {
+					p.P(`cSize := 0`)
+					if gogoproto.IsNullable(field) {
+						p.P(`if `, accessor, ` != nil {`)
+						p.In()
+					}
+					p.P(`cSize = `, accessor, `.Size()`)
+					p.P(`cSize += `, strconv.Itoa(valueKeySize), ` + sov`+p.localName+`(uint64(cSize))`)
+					if gogoproto.IsNullable(field) {
+						p.Out()
+						p.P(`}`)
+					}
+					sum = append(sum, `cSize`)
+				} else {
+					p.P(`byteSize := 0`)
+					if proto3 {
+						p.P(`if len(v) > 0 {`)
+					} else {
+						p.P(`if v != nil {`)
+					}
 					p.In()
 					p.In()
-					p.P(`return 0, `, p.errorsPkg.Use(), `.New("proto: map has nil element")`)
+					p.P(`byteSize = `, strconv.Itoa(valueKeySize), ` + len(v)+sov`+p.localName+`(uint64(len(v)))`)
 					p.Out()
 					p.Out()
 					p.P(`}`)
 					p.P(`}`)
+					sum = append(sum, `byteSize`)
 				}
 				}
-				if valuegoTyp != valuegoAliasTyp {
+			case descriptor.FieldDescriptorProto_TYPE_SINT32,
+				descriptor.FieldDescriptorProto_TYPE_SINT64:
+				sum = append(sum, strconv.Itoa(valueKeySize))
+				sum = append(sum, `soz`+p.localName+`(uint64(v))`)
+			case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
+				if valuegoTyp != valuegoAliasTyp &&
+					!gogoproto.IsStdTime(field) &&
+					!gogoproto.IsStdDuration(field) {
 					if nullable {
 					if nullable {
 						// cast back to the type that has the generated methods on it
 						// cast back to the type that has the generated methods on it
 						accessor = `((` + valuegoTyp + `)(` + accessor + `))`
 						accessor = `((` + valuegoTyp + `)(` + accessor + `))`
@@ -927,31 +974,73 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 				} else if !nullable {
 				} else if !nullable {
 					accessor = `(&v)`
 					accessor = `(&v)`
 				}
 				}
-				if protoSizer {
-					p.P(`msgSize := `, accessor, `.ProtoSize()`)
+				p.P(`msgSize := 0`)
+				p.P(`if `, accessor, ` != nil {`)
+				p.In()
+				if gogoproto.IsStdTime(field) {
+					p.P(`msgSize = `, p.typesPkg.Use(), `.SizeOfStdTime(*`, accessor, `)`)
+				} else if gogoproto.IsStdDuration(field) {
+					p.P(`msgSize = `, p.typesPkg.Use(), `.SizeOfStdDuration(*`, accessor, `)`)
+				} else if protoSizer {
+					p.P(`msgSize = `, accessor, `.ProtoSize()`)
 				} else {
 				} else {
-					p.P(`msgSize := `, accessor, `.Size()`)
+					p.P(`msgSize = `, accessor, `.Size()`)
 				}
 				}
-				sum = append(sum, `msgSize + sov`+p.localName+`(uint64(msgSize))`)
+				p.P(`msgSize += `, strconv.Itoa(valueKeySize), ` + sov`+p.localName+`(uint64(msgSize))`)
+				p.Out()
+				p.P(`}`)
+				sum = append(sum, `msgSize`)
 			}
 			}
 			p.P(`mapSize := `, strings.Join(sum, " + "))
 			p.P(`mapSize := `, strings.Join(sum, " + "))
 			p.callVarint("mapSize")
 			p.callVarint("mapSize")
 			p.encodeKey(1, wireToType(keywire))
 			p.encodeKey(1, wireToType(keywire))
-			p.mapField(numGen, m.KeyField.GetType(), "k", protoSizer)
+			p.mapField(numGen, field, m.KeyField, "k", protoSizer)
+			nullableMsg := nullable && (m.ValueField.GetType() == descriptor.FieldDescriptorProto_TYPE_MESSAGE ||
+				gogoproto.IsCustomType(field) && m.ValueField.IsBytes())
+			plainBytes := m.ValueField.IsBytes() && !gogoproto.IsCustomType(field)
+			if nullableMsg {
+				p.P(`if `, accessor, ` != nil { `)
+				p.In()
+			} else if plainBytes {
+				if proto3 {
+					p.P(`if len(`, accessor, `) > 0 {`)
+				} else {
+					p.P(`if `, accessor, ` != nil {`)
+				}
+				p.In()
+			}
 			p.encodeKey(2, wireToType(valuewire))
 			p.encodeKey(2, wireToType(valuewire))
-			p.mapField(numGen, m.ValueField.GetType(), accessor, protoSizer)
+			p.mapField(numGen, field, m.ValueField, accessor, protoSizer)
+			if nullableMsg || plainBytes {
+				p.Out()
+				p.P(`}`)
+			}
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 		} else if repeated {
 		} else if repeated {
 			p.P(`for _, msg := range m.`, fieldname, ` {`)
 			p.P(`for _, msg := range m.`, fieldname, ` {`)
 			p.In()
 			p.In()
 			p.encodeKey(fieldNumber, wireType)
 			p.encodeKey(fieldNumber, wireType)
-			if protoSizer {
-				p.callVarint("msg.ProtoSize()")
+			varName := "msg"
+			if gogoproto.IsStdTime(field) {
+				if gogoproto.IsNullable(field) {
+					varName = "*" + varName
+				}
+				p.callVarint(p.typesPkg.Use(), `.SizeOfStdTime(`, varName, `)`)
+				p.P(`n, err := `, p.typesPkg.Use(), `.StdTimeMarshalTo(`, varName, `, dAtA[i:])`)
+			} else if gogoproto.IsStdDuration(field) {
+				if gogoproto.IsNullable(field) {
+					varName = "*" + varName
+				}
+				p.callVarint(p.typesPkg.Use(), `.SizeOfStdDuration(`, varName, `)`)
+				p.P(`n, err := `, p.typesPkg.Use(), `.StdDurationMarshalTo(`, varName, `, dAtA[i:])`)
+			} else if protoSizer {
+				p.callVarint(varName, ".ProtoSize()")
+				p.P(`n, err := `, varName, `.MarshalTo(dAtA[i:])`)
 			} else {
 			} else {
-				p.callVarint("msg.Size()")
+				p.callVarint(varName, ".Size()")
+				p.P(`n, err := `, varName, `.MarshalTo(dAtA[i:])`)
 			}
 			}
-			p.P(`n, err := msg.MarshalTo(data[i:])`)
 			p.P(`if err != nil {`)
 			p.P(`if err != nil {`)
 			p.In()
 			p.In()
 			p.P(`return 0, err`)
 			p.P(`return 0, err`)
@@ -962,12 +1051,26 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 			p.P(`}`)
 			p.P(`}`)
 		} else {
 		} else {
 			p.encodeKey(fieldNumber, wireType)
 			p.encodeKey(fieldNumber, wireType)
-			if protoSizer {
-				p.callVarint(`m.`, fieldname, `.ProtoSize()`)
+			varName := `m.` + fieldname
+			if gogoproto.IsStdTime(field) {
+				if gogoproto.IsNullable(field) {
+					varName = "*" + varName
+				}
+				p.callVarint(p.typesPkg.Use(), `.SizeOfStdTime(`, varName, `)`)
+				p.P(`n`, numGen.Next(), `, err := `, p.typesPkg.Use(), `.StdTimeMarshalTo(`, varName, `, dAtA[i:])`)
+			} else if gogoproto.IsStdDuration(field) {
+				if gogoproto.IsNullable(field) {
+					varName = "*" + varName
+				}
+				p.callVarint(p.typesPkg.Use(), `.SizeOfStdDuration(`, varName, `)`)
+				p.P(`n`, numGen.Next(), `, err := `, p.typesPkg.Use(), `.StdDurationMarshalTo(`, varName, `, dAtA[i:])`)
+			} else if protoSizer {
+				p.callVarint(varName, `.ProtoSize()`)
+				p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`)
 			} else {
 			} else {
-				p.callVarint(`m.`, fieldname, `.Size()`)
+				p.callVarint(varName, `.Size()`)
+				p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`)
 			}
 			}
-			p.P(`n`, numGen.Next(), `, err := m.`, fieldname, `.MarshalTo(data[i:])`)
 			p.P(`if err != nil {`)
 			p.P(`if err != nil {`)
 			p.In()
 			p.In()
 			p.P(`return 0, err`)
 			p.P(`return 0, err`)
@@ -982,7 +1085,7 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 				p.In()
 				p.In()
 				p.encodeKey(fieldNumber, wireType)
 				p.encodeKey(fieldNumber, wireType)
 				p.callVarint("len(b)")
 				p.callVarint("len(b)")
-				p.P(`i+=copy(data[i:], b)`)
+				p.P(`i+=copy(dAtA[i:], b)`)
 				p.Out()
 				p.Out()
 				p.P(`}`)
 				p.P(`}`)
 			} else if proto3 {
 			} else if proto3 {
@@ -990,13 +1093,13 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 				p.In()
 				p.In()
 				p.encodeKey(fieldNumber, wireType)
 				p.encodeKey(fieldNumber, wireType)
 				p.callVarint(`len(m.`, fieldname, `)`)
 				p.callVarint(`len(m.`, fieldname, `)`)
-				p.P(`i+=copy(data[i:], m.`, fieldname, `)`)
+				p.P(`i+=copy(dAtA[i:], m.`, fieldname, `)`)
 				p.Out()
 				p.Out()
 				p.P(`}`)
 				p.P(`}`)
 			} else {
 			} else {
 				p.encodeKey(fieldNumber, wireType)
 				p.encodeKey(fieldNumber, wireType)
 				p.callVarint(`len(m.`, fieldname, `)`)
 				p.callVarint(`len(m.`, fieldname, `)`)
-				p.P(`i+=copy(data[i:], m.`, fieldname, `)`)
+				p.P(`i+=copy(dAtA[i:], m.`, fieldname, `)`)
 			}
 			}
 		} else {
 		} else {
 			if repeated {
 			if repeated {
@@ -1008,7 +1111,7 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 				} else {
 				} else {
 					p.callVarint(`msg.Size()`)
 					p.callVarint(`msg.Size()`)
 				}
 				}
-				p.P(`n, err := msg.MarshalTo(data[i:])`)
+				p.P(`n, err := msg.MarshalTo(dAtA[i:])`)
 				p.P(`if err != nil {`)
 				p.P(`if err != nil {`)
 				p.In()
 				p.In()
 				p.P(`return 0, err`)
 				p.P(`return 0, err`)
@@ -1024,7 +1127,7 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 				} else {
 				} else {
 					p.callVarint(`m.`, fieldname, `.Size()`)
 					p.callVarint(`m.`, fieldname, `.Size()`)
 				}
 				}
-				p.P(`n`, numGen.Next(), `, err := m.`, fieldname, `.MarshalTo(data[i:])`)
+				p.P(`n`, numGen.Next(), `, err := m.`, fieldname, `.MarshalTo(dAtA[i:])`)
 				p.P(`if err != nil {`)
 				p.P(`if err != nil {`)
 				p.In()
 				p.In()
 				p.P(`return 0, err`)
 				p.P(`return 0, err`)
@@ -1035,7 +1138,7 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 		}
 		}
 	case descriptor.FieldDescriptorProto_TYPE_SINT32:
 	case descriptor.FieldDescriptorProto_TYPE_SINT32:
 		if packed {
 		if packed {
-			datavar := "data" + numGen.Next()
+			datavar := "dAtA" + numGen.Next()
 			jvar := "j" + numGen.Next()
 			jvar := "j" + numGen.Next()
 			p.P(datavar, ` := make([]byte, len(m.`, fieldname, ")*5)")
 			p.P(datavar, ` := make([]byte, len(m.`, fieldname, ")*5)")
 			p.P(`var `, jvar, ` int`)
 			p.P(`var `, jvar, ` int`)
@@ -1056,7 +1159,7 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 			p.P(`}`)
 			p.P(`}`)
 			p.encodeKey(fieldNumber, wireType)
 			p.encodeKey(fieldNumber, wireType)
 			p.callVarint(jvar)
 			p.callVarint(jvar)
-			p.P(`i+=copy(data[i:], `, datavar, `[:`, jvar, `])`)
+			p.P(`i+=copy(dAtA[i:], `, datavar, `[:`, jvar, `])`)
 		} else if repeated {
 		} else if repeated {
 			p.P(`for _, num := range m.`, fieldname, ` {`)
 			p.P(`for _, num := range m.`, fieldname, ` {`)
 			p.In()
 			p.In()
@@ -1083,7 +1186,7 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 		if packed {
 		if packed {
 			jvar := "j" + numGen.Next()
 			jvar := "j" + numGen.Next()
 			xvar := "x" + numGen.Next()
 			xvar := "x" + numGen.Next()
-			datavar := "data" + numGen.Next()
+			datavar := "dAtA" + numGen.Next()
 			p.P(`var `, jvar, ` int`)
 			p.P(`var `, jvar, ` int`)
 			p.P(datavar, ` := make([]byte, len(m.`, fieldname, `)*10)`)
 			p.P(datavar, ` := make([]byte, len(m.`, fieldname, `)*10)`)
 			p.P(`for _, num := range m.`, fieldname, ` {`)
 			p.P(`for _, num := range m.`, fieldname, ` {`)
@@ -1102,7 +1205,7 @@ func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.Fi
 			p.P(`}`)
 			p.P(`}`)
 			p.encodeKey(fieldNumber, wireType)
 			p.encodeKey(fieldNumber, wireType)
 			p.callVarint(jvar)
 			p.callVarint(jvar)
-			p.P(`i+=copy(data[i:], `, datavar, `[:`, jvar, `])`)
+			p.P(`i+=copy(dAtA[i:], `, datavar, `[:`, jvar, `])`)
 		} else if repeated {
 		} else if repeated {
 			p.P(`for _, num := range m.`, fieldname, ` {`)
 			p.P(`for _, num := range m.`, fieldname, ` {`)
 			p.In()
 			p.In()
@@ -1148,6 +1251,7 @@ func (p *marshalto) Generate(file *generator.FileDescriptor) {
 	}
 	}
 	p.unsafePkg = p.NewImport("unsafe")
 	p.unsafePkg = p.NewImport("unsafe")
 	p.errorsPkg = p.NewImport("errors")
 	p.errorsPkg = p.NewImport("errors")
+	p.typesPkg = p.NewImport("github.com/gogo/protobuf/types")
 
 
 	for _, message := range file.Messages() {
 	for _, message := range file.Messages() {
 		if message.DescriptorProto.GetOptions().GetMapEntry() {
 		if message.DescriptorProto.GetOptions().GetMapEntry() {
@@ -1172,25 +1276,25 @@ func (p *marshalto) Generate(file *generator.FileDescriptor) {
 		}
 		}
 		p.atleastOne = true
 		p.atleastOne = true
 
 
-		p.P(`func (m *`, ccTypeName, `) Marshal() (data []byte, err error) {`)
+		p.P(`func (m *`, ccTypeName, `) Marshal() (dAtA []byte, err error) {`)
 		p.In()
 		p.In()
 		if gogoproto.IsProtoSizer(file.FileDescriptorProto, message.DescriptorProto) {
 		if gogoproto.IsProtoSizer(file.FileDescriptorProto, message.DescriptorProto) {
 			p.P(`size := m.ProtoSize()`)
 			p.P(`size := m.ProtoSize()`)
 		} else {
 		} else {
 			p.P(`size := m.Size()`)
 			p.P(`size := m.Size()`)
 		}
 		}
-		p.P(`data = make([]byte, size)`)
-		p.P(`n, err := m.MarshalTo(data)`)
+		p.P(`dAtA = make([]byte, size)`)
+		p.P(`n, err := m.MarshalTo(dAtA)`)
 		p.P(`if err != nil {`)
 		p.P(`if err != nil {`)
 		p.In()
 		p.In()
 		p.P(`return nil, err`)
 		p.P(`return nil, err`)
 		p.Out()
 		p.Out()
 		p.P(`}`)
 		p.P(`}`)
-		p.P(`return data[:n], nil`)
+		p.P(`return dAtA[:n], nil`)
 		p.Out()
 		p.Out()
 		p.P(`}`)
 		p.P(`}`)
 		p.P(``)
 		p.P(``)
-		p.P(`func (m *`, ccTypeName, `) MarshalTo(data []byte) (int, error) {`)
+		p.P(`func (m *`, ccTypeName, `) MarshalTo(dAtA []byte) (int, error) {`)
 		p.In()
 		p.In()
 		p.P(`var i int`)
 		p.P(`var i int`)
 		p.P(`_ = i`)
 		p.P(`_ = i`)
@@ -1210,7 +1314,7 @@ func (p *marshalto) Generate(file *generator.FileDescriptor) {
 					oneofs[fieldname] = struct{}{}
 					oneofs[fieldname] = struct{}{}
 					p.P(`if m.`, fieldname, ` != nil {`)
 					p.P(`if m.`, fieldname, ` != nil {`)
 					p.In()
 					p.In()
-					p.P(`nn`, numGen.Next(), `, err := m.`, fieldname, `.MarshalTo(data[i:])`)
+					p.P(`nn`, numGen.Next(), `, err := m.`, fieldname, `.MarshalTo(dAtA[i:])`)
 					p.P(`if err != nil {`)
 					p.P(`if err != nil {`)
 					p.In()
 					p.In()
 					p.P(`return 0, err`)
 					p.P(`return 0, err`)
@@ -1224,21 +1328,17 @@ func (p *marshalto) Generate(file *generator.FileDescriptor) {
 		}
 		}
 		if message.DescriptorProto.HasExtension() {
 		if message.DescriptorProto.HasExtension() {
 			if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) {
 			if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) {
-				p.P(`if len(m.XXX_extensions) > 0 {`)
-				p.In()
-				p.P(`n, err := `, p.protoPkg.Use(), `.EncodeExtensionMap(m.XXX_extensions, data[i:])`)
+				p.P(`n, err := `, p.protoPkg.Use(), `.EncodeInternalExtension(m, dAtA[i:])`)
 				p.P(`if err != nil {`)
 				p.P(`if err != nil {`)
 				p.In()
 				p.In()
 				p.P(`return 0, err`)
 				p.P(`return 0, err`)
 				p.Out()
 				p.Out()
 				p.P(`}`)
 				p.P(`}`)
 				p.P(`i+=n`)
 				p.P(`i+=n`)
-				p.Out()
-				p.P(`}`)
 			} else {
 			} else {
 				p.P(`if m.XXX_extensions != nil {`)
 				p.P(`if m.XXX_extensions != nil {`)
 				p.In()
 				p.In()
-				p.P(`i+=copy(data[i:], m.XXX_extensions)`)
+				p.P(`i+=copy(dAtA[i:], m.XXX_extensions)`)
 				p.Out()
 				p.Out()
 				p.P(`}`)
 				p.P(`}`)
 			}
 			}
@@ -1246,7 +1346,7 @@ func (p *marshalto) Generate(file *generator.FileDescriptor) {
 		if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) {
 		if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) {
 			p.P(`if m.XXX_unrecognized != nil {`)
 			p.P(`if m.XXX_unrecognized != nil {`)
 			p.In()
 			p.In()
-			p.P(`i+=copy(data[i:], m.XXX_unrecognized)`)
+			p.P(`i+=copy(dAtA[i:], m.XXX_unrecognized)`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 		}
 		}
@@ -1264,7 +1364,7 @@ func (p *marshalto) Generate(file *generator.FileDescriptor) {
 				continue
 				continue
 			}
 			}
 			ccTypeName := p.OneOfTypeName(message, field)
 			ccTypeName := p.OneOfTypeName(message, field)
-			p.P(`func (m *`, ccTypeName, `) MarshalTo(data []byte) (int, error) {`)
+			p.P(`func (m *`, ccTypeName, `) MarshalTo(dAtA []byte) (int, error) {`)
 			p.In()
 			p.In()
 			p.P(`i := 0`)
 			p.P(`i := 0`)
 			vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly(field)
 			vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly(field)
@@ -1276,40 +1376,40 @@ func (p *marshalto) Generate(file *generator.FileDescriptor) {
 	}
 	}
 
 
 	if p.atleastOne {
 	if p.atleastOne {
-		p.P(`func encodeFixed64`, p.localName, `(data []byte, offset int, v uint64) int {`)
+		p.P(`func encodeFixed64`, p.localName, `(dAtA []byte, offset int, v uint64) int {`)
 		p.In()
 		p.In()
-		p.P(`data[offset] = uint8(v)`)
-		p.P(`data[offset+1] = uint8(v >> 8)`)
-		p.P(`data[offset+2] = uint8(v >> 16)`)
-		p.P(`data[offset+3] = uint8(v >> 24)`)
-		p.P(`data[offset+4] = uint8(v >> 32)`)
-		p.P(`data[offset+5] = uint8(v >> 40)`)
-		p.P(`data[offset+6] = uint8(v >> 48)`)
-		p.P(`data[offset+7] = uint8(v >> 56)`)
+		p.P(`dAtA[offset] = uint8(v)`)
+		p.P(`dAtA[offset+1] = uint8(v >> 8)`)
+		p.P(`dAtA[offset+2] = uint8(v >> 16)`)
+		p.P(`dAtA[offset+3] = uint8(v >> 24)`)
+		p.P(`dAtA[offset+4] = uint8(v >> 32)`)
+		p.P(`dAtA[offset+5] = uint8(v >> 40)`)
+		p.P(`dAtA[offset+6] = uint8(v >> 48)`)
+		p.P(`dAtA[offset+7] = uint8(v >> 56)`)
 		p.P(`return offset+8`)
 		p.P(`return offset+8`)
 		p.Out()
 		p.Out()
 		p.P(`}`)
 		p.P(`}`)
 
 
-		p.P(`func encodeFixed32`, p.localName, `(data []byte, offset int, v uint32) int {`)
+		p.P(`func encodeFixed32`, p.localName, `(dAtA []byte, offset int, v uint32) int {`)
 		p.In()
 		p.In()
-		p.P(`data[offset] = uint8(v)`)
-		p.P(`data[offset+1] = uint8(v >> 8)`)
-		p.P(`data[offset+2] = uint8(v >> 16)`)
-		p.P(`data[offset+3] = uint8(v >> 24)`)
+		p.P(`dAtA[offset] = uint8(v)`)
+		p.P(`dAtA[offset+1] = uint8(v >> 8)`)
+		p.P(`dAtA[offset+2] = uint8(v >> 16)`)
+		p.P(`dAtA[offset+3] = uint8(v >> 24)`)
 		p.P(`return offset+4`)
 		p.P(`return offset+4`)
 		p.Out()
 		p.Out()
 		p.P(`}`)
 		p.P(`}`)
 
 
-		p.P(`func encodeVarint`, p.localName, `(data []byte, offset int, v uint64) int {`)
+		p.P(`func encodeVarint`, p.localName, `(dAtA []byte, offset int, v uint64) int {`)
 		p.In()
 		p.In()
 		p.P(`for v >= 1<<7 {`)
 		p.P(`for v >= 1<<7 {`)
 		p.In()
 		p.In()
-		p.P(`data[offset] = uint8(v&0x7f|0x80)`)
+		p.P(`dAtA[offset] = uint8(v&0x7f|0x80)`)
 		p.P(`v >>= 7`)
 		p.P(`v >>= 7`)
 		p.P(`offset++`)
 		p.P(`offset++`)
 		p.Out()
 		p.Out()
 		p.P(`}`)
 		p.P(`}`)
-		p.P(`data[offset] = uint8(v)`)
+		p.P(`dAtA[offset] = uint8(v)`)
 		p.P(`return offset+1`)
 		p.P(`return offset+1`)
 		p.Out()
 		p.Out()
 		p.P(`}`)
 		p.P(`}`)

+ 3 - 1
vendor/github.com/gogo/protobuf/plugin/oneofcheck/oneofcheck.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without

+ 62 - 40
vendor/github.com/gogo/protobuf/plugin/populate/populate.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
@@ -83,14 +85,15 @@ package populate
 
 
 import (
 import (
 	"fmt"
 	"fmt"
+	"math"
+	"strconv"
+	"strings"
+
 	"github.com/gogo/protobuf/gogoproto"
 	"github.com/gogo/protobuf/gogoproto"
 	"github.com/gogo/protobuf/proto"
 	"github.com/gogo/protobuf/proto"
 	descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor"
 	descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor"
 	"github.com/gogo/protobuf/protoc-gen-gogo/generator"
 	"github.com/gogo/protobuf/protoc-gen-gogo/generator"
 	"github.com/gogo/protobuf/vanity"
 	"github.com/gogo/protobuf/vanity"
-	"math"
-	"strconv"
-	"strings"
 )
 )
 
 
 type VarGen interface {
 type VarGen interface {
@@ -121,6 +124,7 @@ type plugin struct {
 	varGen     VarGen
 	varGen     VarGen
 	atleastOne bool
 	atleastOne bool
 	localName  string
 	localName  string
+	typesPkg   generator.Single
 }
 }
 
 
 func NewPlugin() *plugin {
 func NewPlugin() *plugin {
@@ -178,7 +182,7 @@ func negative(fieldType descriptor.FieldDescriptorProto_Type) bool {
 	return true
 	return true
 }
 }
 
 
-func getFuncName(goTypName string) string {
+func (p *plugin) getFuncName(goTypName string) string {
 	funcName := "NewPopulated" + goTypName
 	funcName := "NewPopulated" + goTypName
 	goTypNames := strings.Split(goTypName, ".")
 	goTypNames := strings.Split(goTypName, ".")
 	if len(goTypNames) == 2 {
 	if len(goTypNames) == 2 {
@@ -186,17 +190,24 @@ func getFuncName(goTypName string) string {
 	} else if len(goTypNames) != 1 {
 	} else if len(goTypNames) != 1 {
 		panic(fmt.Errorf("unreachable: too many dots in %v", goTypName))
 		panic(fmt.Errorf("unreachable: too many dots in %v", goTypName))
 	}
 	}
+	switch funcName {
+	case "time.NewPopulatedTime":
+		funcName = p.typesPkg.Use() + ".NewPopulatedStdTime"
+	case "time.NewPopulatedDuration":
+		p.typesPkg.Use()
+		funcName = p.typesPkg.Use() + ".NewPopulatedStdDuration"
+	}
 	return funcName
 	return funcName
 }
 }
 
 
-func getFuncCall(goTypName string) string {
-	funcName := getFuncName(goTypName)
+func (p *plugin) getFuncCall(goTypName string) string {
+	funcName := p.getFuncName(goTypName)
 	funcCall := funcName + "(r, easy)"
 	funcCall := funcName + "(r, easy)"
 	return funcCall
 	return funcCall
 }
 }
 
 
-func getCustomFuncCall(goTypName string) string {
-	funcName := getFuncName(goTypName)
+func (p *plugin) getCustomFuncCall(goTypName string) string {
+	funcName := p.getFuncName(goTypName)
 	funcCall := funcName + "(r)"
 	funcCall := funcName + "(r)"
 	return funcCall
 	return funcCall
 }
 }
@@ -246,10 +257,17 @@ func (p *plugin) GenerateField(file *generator.FileDescriptor, message *generato
 		if keygoAliasTyp != keygoTyp {
 		if keygoAliasTyp != keygoTyp {
 			keyval = keygoAliasTyp + `(` + keyval + `)`
 			keyval = keygoAliasTyp + `(` + keyval + `)`
 		}
 		}
-		if m.ValueField.IsMessage() || p.IsGroup(field) {
+		if m.ValueField.IsMessage() || p.IsGroup(field) ||
+			(m.ValueField.IsBytes() && gogoproto.IsCustomType(field)) {
 			s := `this.` + fieldname + `[` + keyval + `] = `
 			s := `this.` + fieldname + `[` + keyval + `] = `
-			goTypName = generator.GoTypeToName(valuegoTyp)
-			funcCall := getFuncCall(goTypName)
+			if gogoproto.IsStdTime(field) || gogoproto.IsStdDuration(field) {
+				valuegoTyp = valuegoAliasTyp
+			}
+			funcCall := p.getCustomFuncCall(goTypName)
+			if !gogoproto.IsCustomType(field) {
+				goTypName = generator.GoTypeToName(valuegoTyp)
+				funcCall = p.getFuncCall(goTypName)
+			}
 			if !nullable {
 			if !nullable {
 				funcCall = `*` + funcCall
 				funcCall = `*` + funcCall
 			}
 			}
@@ -288,7 +306,7 @@ func (p *plugin) GenerateField(file *generator.FileDescriptor, message *generato
 		p.Out()
 		p.Out()
 		p.P(`}`)
 		p.P(`}`)
 	} else if field.IsMessage() || p.IsGroup(field) {
 	} else if field.IsMessage() || p.IsGroup(field) {
-		funcCall := getFuncCall(goTypName)
+		funcCall := p.getFuncCall(goTypName)
 		if field.IsRepeated() {
 		if field.IsRepeated() {
 			p.P(p.varGen.Next(), ` := r.Intn(5)`)
 			p.P(p.varGen.Next(), ` := r.Intn(5)`)
 			p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`)
 			p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`)
@@ -328,7 +346,7 @@ func (p *plugin) GenerateField(file *generator.FileDescriptor, message *generato
 				p.P(`this.`, fieldname, ` = &`, p.varGen.Current())
 				p.P(`this.`, fieldname, ` = &`, p.varGen.Current())
 			}
 			}
 		} else if gogoproto.IsCustomType(field) {
 		} else if gogoproto.IsCustomType(field) {
-			funcCall := getCustomFuncCall(goTypName)
+			funcCall := p.getCustomFuncCall(goTypName)
 			if field.IsRepeated() {
 			if field.IsRepeated() {
 				p.P(p.varGen.Next(), ` := r.Intn(10)`)
 				p.P(p.varGen.Next(), ` := r.Intn(10)`)
 				p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`)
 				p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`)
@@ -369,7 +387,8 @@ func (p *plugin) GenerateField(file *generator.FileDescriptor, message *generato
 				p.P(`}`)
 				p.P(`}`)
 			}
 			}
 		} else if field.IsString() {
 		} else if field.IsString() {
-			val := fmt.Sprintf("randString%v(r)", p.localName)
+			typName := generator.GoTypeToName(goTyp)
+			val := fmt.Sprintf("%s(randString%v(r))", typName, p.localName)
 			if field.IsRepeated() {
 			if field.IsRepeated() {
 				p.P(p.varGen.Next(), ` := r.Intn(10)`)
 				p.P(p.varGen.Next(), ` := r.Intn(10)`)
 				p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`)
 				p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`)
@@ -449,11 +468,14 @@ func (p *plugin) hasLoop(field *descriptor.FieldDescriptorProto, visited []*gene
 				return fieldMessage
 				return fieldMessage
 			}
 			}
 		}
 		}
+		pkg := strings.Split(field.GetTypeName(), ".")[1]
 		for _, f := range fieldMessage.Field {
 		for _, f := range fieldMessage.Field {
-			visited = append(visited, fieldMessage)
-			loopTo := p.hasLoop(f, visited, excludes)
-			if loopTo != nil {
-				return loopTo
+			if strings.HasPrefix(f.GetTypeName(), "."+pkg+".") {
+				visited = append(visited, fieldMessage)
+				loopTo := p.hasLoop(f, visited, excludes)
+				if loopTo != nil {
+					return loopTo
+				}
 			}
 			}
 		}
 		}
 	}
 	}
@@ -482,7 +504,7 @@ func (p *plugin) Generate(file *generator.FileDescriptor) {
 	p.PluginImports = generator.NewPluginImports(p.Generator)
 	p.PluginImports = generator.NewPluginImports(p.Generator)
 	p.varGen = NewVarGen()
 	p.varGen = NewVarGen()
 	proto3 := gogoproto.IsProto3(file.FileDescriptorProto)
 	proto3 := gogoproto.IsProto3(file.FileDescriptorProto)
-
+	p.typesPkg = p.NewImport("github.com/gogo/protobuf/types")
 	p.localName = generator.FileName(file)
 	p.localName = generator.FileName(file)
 	protoPkg := p.NewImport("github.com/gogo/protobuf/proto")
 	protoPkg := p.NewImport("github.com/gogo/protobuf/proto")
 	if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) {
 	if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) {
@@ -612,8 +634,8 @@ func (p *plugin) Generate(file *generator.FileDescriptor) {
 				}
 				}
 				p.P(`wire := r.Intn(4)`)
 				p.P(`wire := r.Intn(4)`)
 				p.P(`if wire == 3 { wire = 5 }`)
 				p.P(`if wire == 3 { wire = 5 }`)
-				p.P(`data := randField`, p.localName, `(nil, r, fieldNumber, wire)`)
-				p.P(protoPkg.Use(), `.SetRawExtension(this, int32(fieldNumber), data)`)
+				p.P(`dAtA := randField`, p.localName, `(nil, r, fieldNumber, wire)`)
+				p.P(protoPkg.Use(), `.SetRawExtension(this, int32(fieldNumber), dAtA)`)
 				p.Out()
 				p.Out()
 				p.P(`}`)
 				p.P(`}`)
 				p.Out()
 				p.Out()
@@ -698,7 +720,7 @@ func (p *plugin) Generate(file *generator.FileDescriptor) {
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
 
 
-	p.P(`func randUnrecognized`, p.localName, `(r randy`, p.localName, `, maxFieldNumber int) (data []byte) {`)
+	p.P(`func randUnrecognized`, p.localName, `(r randy`, p.localName, `, maxFieldNumber int) (dAtA []byte) {`)
 	p.In()
 	p.In()
 	p.P(`l := r.Intn(5)`)
 	p.P(`l := r.Intn(5)`)
 	p.P(`for i := 0; i < l; i++ {`)
 	p.P(`for i := 0; i < l; i++ {`)
@@ -706,64 +728,64 @@ func (p *plugin) Generate(file *generator.FileDescriptor) {
 	p.P(`wire := r.Intn(4)`)
 	p.P(`wire := r.Intn(4)`)
 	p.P(`if wire == 3 { wire = 5 }`)
 	p.P(`if wire == 3 { wire = 5 }`)
 	p.P(`fieldNumber := maxFieldNumber + r.Intn(100)`)
 	p.P(`fieldNumber := maxFieldNumber + r.Intn(100)`)
-	p.P(`data = randField`, p.localName, `(data, r, fieldNumber, wire)`)
+	p.P(`dAtA = randField`, p.localName, `(dAtA, r, fieldNumber, wire)`)
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
-	p.P(`return data`)
+	p.P(`return dAtA`)
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
 
 
-	p.P(`func randField`, p.localName, `(data []byte, r randy`, p.localName, `, fieldNumber int, wire int) []byte {`)
+	p.P(`func randField`, p.localName, `(dAtA []byte, r randy`, p.localName, `, fieldNumber int, wire int) []byte {`)
 	p.In()
 	p.In()
 	p.P(`key := uint32(fieldNumber)<<3 | uint32(wire)`)
 	p.P(`key := uint32(fieldNumber)<<3 | uint32(wire)`)
 	p.P(`switch wire {`)
 	p.P(`switch wire {`)
 	p.P(`case 0:`)
 	p.P(`case 0:`)
 	p.In()
 	p.In()
-	p.P(`data = encodeVarintPopulate`, p.localName, `(data, uint64(key))`)
+	p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(key))`)
 	p.P(p.varGen.Next(), ` := r.Int63()`)
 	p.P(p.varGen.Next(), ` := r.Int63()`)
 	p.P(`if r.Intn(2) == 0 {`)
 	p.P(`if r.Intn(2) == 0 {`)
 	p.In()
 	p.In()
 	p.P(p.varGen.Current(), ` *= -1`)
 	p.P(p.varGen.Current(), ` *= -1`)
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
-	p.P(`data = encodeVarintPopulate`, p.localName, `(data, uint64(`, p.varGen.Current(), `))`)
+	p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(`, p.varGen.Current(), `))`)
 	p.Out()
 	p.Out()
 	p.P(`case 1:`)
 	p.P(`case 1:`)
 	p.In()
 	p.In()
-	p.P(`data = encodeVarintPopulate`, p.localName, `(data, uint64(key))`)
-	p.P(`data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))`)
+	p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(key))`)
+	p.P(`dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))`)
 	p.Out()
 	p.Out()
 	p.P(`case 2:`)
 	p.P(`case 2:`)
 	p.In()
 	p.In()
-	p.P(`data = encodeVarintPopulate`, p.localName, `(data, uint64(key))`)
+	p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(key))`)
 	p.P(`ll := r.Intn(100)`)
 	p.P(`ll := r.Intn(100)`)
-	p.P(`data = encodeVarintPopulate`, p.localName, `(data, uint64(ll))`)
+	p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(ll))`)
 	p.P(`for j := 0; j < ll; j++ {`)
 	p.P(`for j := 0; j < ll; j++ {`)
 	p.In()
 	p.In()
-	p.P(`data = append(data, byte(r.Intn(256)))`)
+	p.P(`dAtA = append(dAtA, byte(r.Intn(256)))`)
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
 	p.Out()
 	p.Out()
 	p.P(`default:`)
 	p.P(`default:`)
 	p.In()
 	p.In()
-	p.P(`data = encodeVarintPopulate`, p.localName, `(data, uint64(key))`)
-	p.P(`data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))`)
+	p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(key))`)
+	p.P(`dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))`)
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
-	p.P(`return data`)
+	p.P(`return dAtA`)
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
 
 
-	p.P(`func encodeVarintPopulate`, p.localName, `(data []byte, v uint64) []byte {`)
+	p.P(`func encodeVarintPopulate`, p.localName, `(dAtA []byte, v uint64) []byte {`)
 	p.In()
 	p.In()
 	p.P(`for v >= 1<<7 {`)
 	p.P(`for v >= 1<<7 {`)
 	p.In()
 	p.In()
-	p.P(`data = append(data, uint8(uint64(v)&0x7f|0x80))`)
+	p.P(`dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))`)
 	p.P(`v >>= 7`)
 	p.P(`v >>= 7`)
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
-	p.P(`data = append(data, uint8(v))`)
-	p.P(`return data`)
+	p.P(`dAtA = append(dAtA, uint8(v))`)
+	p.P(`return dAtA`)
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
 
 

+ 88 - 18
vendor/github.com/gogo/protobuf/plugin/size/size.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
@@ -88,13 +90,13 @@ and the following test code:
 	func TestBSize(t *testing5.T) {
 	func TestBSize(t *testing5.T) {
 		popr := math_rand5.New(math_rand5.NewSource(time5.Now().UnixNano()))
 		popr := math_rand5.New(math_rand5.NewSource(time5.Now().UnixNano()))
 		p := NewPopulatedB(popr, true)
 		p := NewPopulatedB(popr, true)
-		data, err := github_com_gogo_protobuf_proto2.Marshal(p)
+		dAtA, err := github_com_gogo_protobuf_proto2.Marshal(p)
 		if err != nil {
 		if err != nil {
 			panic(err)
 			panic(err)
 		}
 		}
 		size := p.Size()
 		size := p.Size()
-		if len(data) != size {
-			t.Fatalf("size %v != marshalled size %v", size, len(data))
+		if len(dAtA) != size {
+			t.Fatalf("size %v != marshalled size %v", size, len(dAtA))
 		}
 		}
 	}
 	}
 
 
@@ -134,6 +136,7 @@ type size struct {
 	generator.PluginImports
 	generator.PluginImports
 	atleastOne bool
 	atleastOne bool
 	localName  string
 	localName  string
+	typesPkg   generator.Single
 }
 }
 
 
 func NewSize() *size {
 func NewSize() *size {
@@ -198,6 +201,23 @@ func (p *size) sizeZigZag() {
 	}`)
 	}`)
 }
 }
 
 
+func (p *size) std(field *descriptor.FieldDescriptorProto, name string) (string, bool) {
+	if gogoproto.IsStdTime(field) {
+		if gogoproto.IsNullable(field) {
+			return p.typesPkg.Use() + `.SizeOfStdTime(*` + name + `)`, true
+		} else {
+			return p.typesPkg.Use() + `.SizeOfStdTime(` + name + `)`, true
+		}
+	} else if gogoproto.IsStdDuration(field) {
+		if gogoproto.IsNullable(field) {
+			return p.typesPkg.Use() + `.SizeOfStdDuration(*` + name + `)`, true
+		} else {
+			return p.typesPkg.Use() + `.SizeOfStdDuration(` + name + `)`, true
+		}
+	}
+	return "", false
+}
+
 func (p *size) generateField(proto3 bool, file *generator.FileDescriptor, message *generator.Descriptor, field *descriptor.FieldDescriptorProto, sizeName string) {
 func (p *size) generateField(proto3 bool, file *generator.FileDescriptor, message *generator.Descriptor, field *descriptor.FieldDescriptorProto, sizeName string) {
 	fieldname := p.GetOneOfFieldName(message, field)
 	fieldname := p.GetOneOfFieldName(message, field)
 	nullable := gogoproto.IsNullable(field)
 	nullable := gogoproto.IsNullable(field)
@@ -210,7 +230,7 @@ func (p *size) generateField(proto3 bool, file *generator.FileDescriptor, messag
 		p.P(`if m.`, fieldname, ` != nil {`)
 		p.P(`if m.`, fieldname, ` != nil {`)
 		p.In()
 		p.In()
 	}
 	}
-	packed := field.IsPacked()
+	packed := field.IsPacked() || (proto3 && field.IsPacked3())
 	_, wire := p.GoType(message, field)
 	_, wire := p.GoType(message, field)
 	wireType := wireToType(wire)
 	wireType := wireToType(wire)
 	fieldNumber := field.GetNumber()
 	fieldNumber := field.GetNumber()
@@ -367,50 +387,89 @@ func (p *size) generateField(proto3 bool, file *generator.FileDescriptor, messag
 				descriptor.FieldDescriptorProto_TYPE_SINT64:
 				descriptor.FieldDescriptorProto_TYPE_SINT64:
 				sum = append(sum, `soz`+p.localName+`(uint64(k))`)
 				sum = append(sum, `soz`+p.localName+`(uint64(k))`)
 			}
 			}
-			sum = append(sum, strconv.Itoa(valueKeySize))
 			switch m.ValueField.GetType() {
 			switch m.ValueField.GetType() {
 			case descriptor.FieldDescriptorProto_TYPE_DOUBLE,
 			case descriptor.FieldDescriptorProto_TYPE_DOUBLE,
 				descriptor.FieldDescriptorProto_TYPE_FIXED64,
 				descriptor.FieldDescriptorProto_TYPE_FIXED64,
 				descriptor.FieldDescriptorProto_TYPE_SFIXED64:
 				descriptor.FieldDescriptorProto_TYPE_SFIXED64:
+				sum = append(sum, strconv.Itoa(valueKeySize))
 				sum = append(sum, strconv.Itoa(8))
 				sum = append(sum, strconv.Itoa(8))
 			case descriptor.FieldDescriptorProto_TYPE_FLOAT,
 			case descriptor.FieldDescriptorProto_TYPE_FLOAT,
 				descriptor.FieldDescriptorProto_TYPE_FIXED32,
 				descriptor.FieldDescriptorProto_TYPE_FIXED32,
 				descriptor.FieldDescriptorProto_TYPE_SFIXED32:
 				descriptor.FieldDescriptorProto_TYPE_SFIXED32:
+				sum = append(sum, strconv.Itoa(valueKeySize))
 				sum = append(sum, strconv.Itoa(4))
 				sum = append(sum, strconv.Itoa(4))
 			case descriptor.FieldDescriptorProto_TYPE_INT64,
 			case descriptor.FieldDescriptorProto_TYPE_INT64,
 				descriptor.FieldDescriptorProto_TYPE_UINT64,
 				descriptor.FieldDescriptorProto_TYPE_UINT64,
 				descriptor.FieldDescriptorProto_TYPE_UINT32,
 				descriptor.FieldDescriptorProto_TYPE_UINT32,
 				descriptor.FieldDescriptorProto_TYPE_ENUM,
 				descriptor.FieldDescriptorProto_TYPE_ENUM,
 				descriptor.FieldDescriptorProto_TYPE_INT32:
 				descriptor.FieldDescriptorProto_TYPE_INT32:
+				sum = append(sum, strconv.Itoa(valueKeySize))
 				sum = append(sum, `sov`+p.localName+`(uint64(v))`)
 				sum = append(sum, `sov`+p.localName+`(uint64(v))`)
 			case descriptor.FieldDescriptorProto_TYPE_BOOL:
 			case descriptor.FieldDescriptorProto_TYPE_BOOL:
+				sum = append(sum, strconv.Itoa(valueKeySize))
 				sum = append(sum, `1`)
 				sum = append(sum, `1`)
-			case descriptor.FieldDescriptorProto_TYPE_STRING,
-				descriptor.FieldDescriptorProto_TYPE_BYTES:
+			case descriptor.FieldDescriptorProto_TYPE_STRING:
+				sum = append(sum, strconv.Itoa(valueKeySize))
 				sum = append(sum, `len(v)+sov`+p.localName+`(uint64(len(v)))`)
 				sum = append(sum, `len(v)+sov`+p.localName+`(uint64(len(v)))`)
+			case descriptor.FieldDescriptorProto_TYPE_BYTES:
+				if gogoproto.IsCustomType(field) {
+					p.P(`l = 0`)
+					if nullable {
+						p.P(`if v != nil {`)
+						p.In()
+					}
+					p.P(`l = v.`, sizeName, `()`)
+					p.P(`l += `, strconv.Itoa(valueKeySize), ` + sov`+p.localName+`(uint64(l))`)
+					if nullable {
+						p.Out()
+						p.P(`}`)
+					}
+					sum = append(sum, `l`)
+				} else {
+					p.P(`l = 0`)
+					if proto3 {
+						p.P(`if len(v) > 0 {`)
+					} else {
+						p.P(`if v != nil {`)
+					}
+					p.In()
+					p.P(`l = `, strconv.Itoa(valueKeySize), ` + len(v)+sov`+p.localName+`(uint64(len(v)))`)
+					p.Out()
+					p.P(`}`)
+					sum = append(sum, `l`)
+				}
 			case descriptor.FieldDescriptorProto_TYPE_SINT32,
 			case descriptor.FieldDescriptorProto_TYPE_SINT32,
 				descriptor.FieldDescriptorProto_TYPE_SINT64:
 				descriptor.FieldDescriptorProto_TYPE_SINT64:
+				sum = append(sum, strconv.Itoa(valueKeySize))
 				sum = append(sum, `soz`+p.localName+`(uint64(v))`)
 				sum = append(sum, `soz`+p.localName+`(uint64(v))`)
 			case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
 			case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
+				stdSizeCall, stdOk := p.std(field, "v")
 				if nullable {
 				if nullable {
 					p.P(`l = 0`)
 					p.P(`l = 0`)
 					p.P(`if v != nil {`)
 					p.P(`if v != nil {`)
 					p.In()
 					p.In()
-					if valuegoTyp != valuegoAliasTyp {
+					if stdOk {
+						p.P(`l = `, stdSizeCall)
+					} else if valuegoTyp != valuegoAliasTyp {
 						p.P(`l = ((`, valuegoTyp, `)(v)).`, sizeName, `()`)
 						p.P(`l = ((`, valuegoTyp, `)(v)).`, sizeName, `()`)
 					} else {
 					} else {
 						p.P(`l = v.`, sizeName, `()`)
 						p.P(`l = v.`, sizeName, `()`)
 					}
 					}
+					p.P(`l += `, strconv.Itoa(valueKeySize), ` + sov`+p.localName+`(uint64(l))`)
 					p.Out()
 					p.Out()
 					p.P(`}`)
 					p.P(`}`)
+					sum = append(sum, `l`)
 				} else {
 				} else {
-					if valuegoTyp != valuegoAliasTyp {
+					if stdOk {
+						p.P(`l = `, stdSizeCall)
+					} else if valuegoTyp != valuegoAliasTyp {
 						p.P(`l = ((*`, valuegoTyp, `)(&v)).`, sizeName, `()`)
 						p.P(`l = ((*`, valuegoTyp, `)(&v)).`, sizeName, `()`)
 					} else {
 					} else {
 						p.P(`l = v.`, sizeName, `()`)
 						p.P(`l = v.`, sizeName, `()`)
 					}
 					}
+					sum = append(sum, strconv.Itoa(valueKeySize))
+					sum = append(sum, `l+sov`+p.localName+`(uint64(l))`)
 				}
 				}
-				sum = append(sum, `l+sov`+p.localName+`(uint64(l))`)
 			}
 			}
 			p.P(`mapEntrySize := `, strings.Join(sum, "+"))
 			p.P(`mapEntrySize := `, strings.Join(sum, "+"))
 			p.P(`n+=mapEntrySize+`, fieldKeySize, `+sov`, p.localName, `(uint64(mapEntrySize))`)
 			p.P(`n+=mapEntrySize+`, fieldKeySize, `+sov`, p.localName, `(uint64(mapEntrySize))`)
@@ -419,12 +478,22 @@ func (p *size) generateField(proto3 bool, file *generator.FileDescriptor, messag
 		} else if repeated {
 		} else if repeated {
 			p.P(`for _, e := range m.`, fieldname, ` { `)
 			p.P(`for _, e := range m.`, fieldname, ` { `)
 			p.In()
 			p.In()
-			p.P(`l=e.`, sizeName, `()`)
+			stdSizeCall, stdOk := p.std(field, "e")
+			if stdOk {
+				p.P(`l=`, stdSizeCall)
+			} else {
+				p.P(`l=e.`, sizeName, `()`)
+			}
 			p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`)
 			p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 		} else {
 		} else {
-			p.P(`l=m.`, fieldname, `.`, sizeName, `()`)
+			stdSizeCall, stdOk := p.std(field, "m."+fieldname)
+			if stdOk {
+				p.P(`l=`, stdSizeCall)
+			} else {
+				p.P(`l=m.`, fieldname, `.`, sizeName, `()`)
+			}
 			p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`)
 			p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`)
 		}
 		}
 	case descriptor.FieldDescriptorProto_TYPE_BYTES:
 	case descriptor.FieldDescriptorProto_TYPE_BYTES:
@@ -500,6 +569,7 @@ func (p *size) Generate(file *generator.FileDescriptor) {
 	p.PluginImports = generator.NewPluginImports(p.Generator)
 	p.PluginImports = generator.NewPluginImports(p.Generator)
 	p.atleastOne = false
 	p.atleastOne = false
 	p.localName = generator.FileName(file)
 	p.localName = generator.FileName(file)
+	p.typesPkg = p.NewImport("github.com/gogo/protobuf/types")
 	protoPkg := p.NewImport("github.com/gogo/protobuf/proto")
 	protoPkg := p.NewImport("github.com/gogo/protobuf/proto")
 	if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) {
 	if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) {
 		protoPkg = p.NewImport("github.com/golang/protobuf/proto")
 		protoPkg = p.NewImport("github.com/golang/protobuf/proto")
@@ -543,15 +613,15 @@ func (p *size) Generate(file *generator.FileDescriptor) {
 			}
 			}
 		}
 		}
 		if message.DescriptorProto.HasExtension() {
 		if message.DescriptorProto.HasExtension() {
-			p.P(`if m.XXX_extensions != nil {`)
-			p.In()
 			if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) {
 			if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) {
-				p.P(`n += `, protoPkg.Use(), `.SizeOfExtensionMap(m.XXX_extensions)`)
+				p.P(`n += `, protoPkg.Use(), `.SizeOfInternalExtension(m)`)
 			} else {
 			} else {
+				p.P(`if m.XXX_extensions != nil {`)
+				p.In()
 				p.P(`n+=len(m.XXX_extensions)`)
 				p.P(`n+=len(m.XXX_extensions)`)
+				p.Out()
+				p.P(`}`)
 			}
 			}
-			p.Out()
-			p.P(`}`)
 		}
 		}
 		if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) {
 		if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) {
 			p.P(`if m.XXX_unrecognized != nil {`)
 			p.P(`if m.XXX_unrecognized != nil {`)

+ 6 - 4
vendor/github.com/gogo/protobuf/plugin/size/sizetest.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
@@ -71,16 +73,16 @@ func (p *test) Generate(imports generator.PluginImports, file *generator.FileDes
 			p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`)
 			p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`)
 			p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`)
 			p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`)
 			p.P(`size2 := `, protoPkg.Use(), `.Size(p)`)
 			p.P(`size2 := `, protoPkg.Use(), `.Size(p)`)
-			p.P(`data, err := `, protoPkg.Use(), `.Marshal(p)`)
+			p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(p)`)
 			p.P(`if err != nil {`)
 			p.P(`if err != nil {`)
 			p.In()
 			p.In()
 			p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`)
 			p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			p.P(`size := p.`, sizeName, `()`)
 			p.P(`size := p.`, sizeName, `()`)
-			p.P(`if len(data) != size {`)
+			p.P(`if len(dAtA) != size {`)
 			p.In()
 			p.In()
-			p.P(`t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(data))`)
+			p.P(`t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			p.P(`if size2 != size {`)
 			p.P(`if size2 != size {`)

+ 6 - 3
vendor/github.com/gogo/protobuf/plugin/stringer/stringer.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
@@ -126,6 +128,7 @@ func (p *stringer) Generate(file *generator.FileDescriptor) {
 	stringsPkg := p.NewImport("strings")
 	stringsPkg := p.NewImport("strings")
 	reflectPkg := p.NewImport("reflect")
 	reflectPkg := p.NewImport("reflect")
 	sortKeysPkg := p.NewImport("github.com/gogo/protobuf/sortkeys")
 	sortKeysPkg := p.NewImport("github.com/gogo/protobuf/sortkeys")
+	protoPkg := p.NewImport("github.com/gogo/protobuf/proto")
 	for _, message := range file.Messages() {
 	for _, message := range file.Messages() {
 		if !gogoproto.IsStringer(file.FileDescriptorProto, message.DescriptorProto) {
 		if !gogoproto.IsStringer(file.FileDescriptorProto, message.DescriptorProto) {
 			continue
 			continue
@@ -222,9 +225,9 @@ func (p *stringer) Generate(file *generator.FileDescriptor) {
 		}
 		}
 		if message.DescriptorProto.HasExtension() {
 		if message.DescriptorProto.HasExtension() {
 			if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) {
 			if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) {
-				p.P("`XXX_extensions:` + proto.StringFromExtensionsMap(this.XXX_extensions) + `,`,")
+				p.P("`XXX_InternalExtensions:` + ", protoPkg.Use(), ".StringFromInternalExtension(this) + `,`,")
 			} else {
 			} else {
-				p.P("`XXX_extensions:` + proto.StringFromExtensionsBytes(this.XXX_extensions) + `,`,")
+				p.P("`XXX_extensions:` + ", protoPkg.Use(), ".StringFromExtensionsBytes(this.XXX_extensions) + `,`,")
 			}
 			}
 		}
 		}
 		if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) {
 		if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) {

+ 3 - 1
vendor/github.com/gogo/protobuf/plugin/stringer/stringertest.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without

+ 36 - 34
vendor/github.com/gogo/protobuf/plugin/testgen/testgen.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
@@ -61,16 +63,16 @@ given to the testgen plugin, will generate the following test code:
 	func TestAProto(t *testing.T) {
 	func TestAProto(t *testing.T) {
 		popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
 		popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
 		p := NewPopulatedA(popr, false)
 		p := NewPopulatedA(popr, false)
-		data, err := github_com_gogo_protobuf_proto.Marshal(p)
+		dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
 		if err != nil {
 		if err != nil {
 			panic(err)
 			panic(err)
 		}
 		}
 		msg := &A{}
 		msg := &A{}
-		if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil {
+		if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
 			panic(err)
 			panic(err)
 		}
 		}
-		for i := range data {
-			data[i] = byte(popr.Intn(256))
+		for i := range dAtA {
+			dAtA[i] = byte(popr.Intn(256))
 		}
 		}
 		if err := p.VerboseEqual(msg); err != nil {
 		if err := p.VerboseEqual(msg); err != nil {
 			t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err)
 			t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err)
@@ -89,11 +91,11 @@ given to the testgen plugin, will generate the following test code:
 		}
 		}
 		b.ResetTimer()
 		b.ResetTimer()
 		for i := 0; i < b.N; i++ {
 		for i := 0; i < b.N; i++ {
-			data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
+			dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
 			if err != nil {
 			if err != nil {
 				panic(err)
 				panic(err)
 			}
 			}
-			total += len(data)
+			total += len(dAtA)
 		}
 		}
 		b.SetBytes(int64(total / b.N))
 		b.SetBytes(int64(total / b.N))
 	}
 	}
@@ -103,11 +105,11 @@ given to the testgen plugin, will generate the following test code:
 		total := 0
 		total := 0
 		datas := make([][]byte, 10000)
 		datas := make([][]byte, 10000)
 		for i := 0; i < 10000; i++ {
 		for i := 0; i < 10000; i++ {
-			data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedA(popr, false))
+			dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedA(popr, false))
 			if err != nil {
 			if err != nil {
 				panic(err)
 				panic(err)
 			}
 			}
-			datas[i] = data
+			datas[i] = dAtA
 		}
 		}
 		msg := &A{}
 		msg := &A{}
 		b.ResetTimer()
 		b.ResetTimer()
@@ -144,9 +146,9 @@ given to the testgen plugin, will generate the following test code:
 	func TestAProtoText(t *testing2.T) {
 	func TestAProtoText(t *testing2.T) {
 		popr := math_rand2.New(math_rand2.NewSource(time2.Now().UnixNano()))
 		popr := math_rand2.New(math_rand2.NewSource(time2.Now().UnixNano()))
 		p := NewPopulatedA(popr, true)
 		p := NewPopulatedA(popr, true)
-		data := github_com_gogo_protobuf_proto1.MarshalTextString(p)
+		dAtA := github_com_gogo_protobuf_proto1.MarshalTextString(p)
 		msg := &A{}
 		msg := &A{}
-		if err := github_com_gogo_protobuf_proto1.UnmarshalText(data, msg); err != nil {
+		if err := github_com_gogo_protobuf_proto1.UnmarshalText(dAtA, msg); err != nil {
 			panic(err)
 			panic(err)
 		}
 		}
 		if err := p.VerboseEqual(msg); err != nil {
 		if err := p.VerboseEqual(msg); err != nil {
@@ -160,9 +162,9 @@ given to the testgen plugin, will generate the following test code:
 	func TestAProtoCompactText(t *testing2.T) {
 	func TestAProtoCompactText(t *testing2.T) {
 		popr := math_rand2.New(math_rand2.NewSource(time2.Now().UnixNano()))
 		popr := math_rand2.New(math_rand2.NewSource(time2.Now().UnixNano()))
 		p := NewPopulatedA(popr, true)
 		p := NewPopulatedA(popr, true)
-		data := github_com_gogo_protobuf_proto1.CompactTextString(p)
+		dAtA := github_com_gogo_protobuf_proto1.CompactTextString(p)
 		msg := &A{}
 		msg := &A{}
-		if err := github_com_gogo_protobuf_proto1.UnmarshalText(data, msg); err != nil {
+		if err := github_com_gogo_protobuf_proto1.UnmarshalText(dAtA, msg); err != nil {
 			panic(err)
 			panic(err)
 		}
 		}
 		if err := p.VerboseEqual(msg); err != nil {
 		if err := p.VerboseEqual(msg); err != nil {
@@ -285,23 +287,23 @@ func (p *testProto) Generate(imports generator.PluginImports, file *generator.Fi
 			p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`)
 			p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`)
 			p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`)
 			p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`)
 			p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`)
 			p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`)
-			p.P(`data, err := `, protoPkg.Use(), `.Marshal(p)`)
+			p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(p)`)
 			p.P(`if err != nil {`)
 			p.P(`if err != nil {`)
 			p.In()
 			p.In()
 			p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`)
 			p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			p.P(`msg := &`, ccTypeName, `{}`)
 			p.P(`msg := &`, ccTypeName, `{}`)
-			p.P(`if err := `, protoPkg.Use(), `.Unmarshal(data, msg); err != nil {`)
+			p.P(`if err := `, protoPkg.Use(), `.Unmarshal(dAtA, msg); err != nil {`)
 			p.In()
 			p.In()
 			p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`)
 			p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
-			p.P(`littlefuzz := make([]byte, len(data))`)
-			p.P(`copy(littlefuzz, data)`)
-			p.P(`for i := range data {`)
+			p.P(`littlefuzz := make([]byte, len(dAtA))`)
+			p.P(`copy(littlefuzz, dAtA)`)
+			p.P(`for i := range dAtA {`)
 			p.In()
 			p.In()
-			p.P(`data[i] = byte(popr.Intn(256))`)
+			p.P(`dAtA[i] = byte(popr.Intn(256))`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			if gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) {
 			if gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) {
@@ -346,27 +348,27 @@ func (p *testProto) Generate(imports generator.PluginImports, file *generator.Fi
 				} else {
 				} else {
 					p.P(`size := p.Size()`)
 					p.P(`size := p.Size()`)
 				}
 				}
-				p.P(`data := make([]byte, size)`)
-				p.P(`for i := range data {`)
+				p.P(`dAtA := make([]byte, size)`)
+				p.P(`for i := range dAtA {`)
 				p.In()
 				p.In()
-				p.P(`data[i] = byte(popr.Intn(256))`)
+				p.P(`dAtA[i] = byte(popr.Intn(256))`)
 				p.Out()
 				p.Out()
 				p.P(`}`)
 				p.P(`}`)
-				p.P(`_, err := p.MarshalTo(data)`)
+				p.P(`_, err := p.MarshalTo(dAtA)`)
 				p.P(`if err != nil {`)
 				p.P(`if err != nil {`)
 				p.In()
 				p.In()
 				p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`)
 				p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`)
 				p.Out()
 				p.Out()
 				p.P(`}`)
 				p.P(`}`)
 				p.P(`msg := &`, ccTypeName, `{}`)
 				p.P(`msg := &`, ccTypeName, `{}`)
-				p.P(`if err := `, protoPkg.Use(), `.Unmarshal(data, msg); err != nil {`)
+				p.P(`if err := `, protoPkg.Use(), `.Unmarshal(dAtA, msg); err != nil {`)
 				p.In()
 				p.In()
 				p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`)
 				p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`)
 				p.Out()
 				p.Out()
 				p.P(`}`)
 				p.P(`}`)
-				p.P(`for i := range data {`)
+				p.P(`for i := range dAtA {`)
 				p.In()
 				p.In()
-				p.P(`data[i] = byte(popr.Intn(256))`)
+				p.P(`dAtA[i] = byte(popr.Intn(256))`)
 				p.Out()
 				p.Out()
 				p.P(`}`)
 				p.P(`}`)
 				if gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) {
 				if gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) {
@@ -402,13 +404,13 @@ func (p *testProto) Generate(imports generator.PluginImports, file *generator.Fi
 			p.P(`b.ResetTimer()`)
 			p.P(`b.ResetTimer()`)
 			p.P(`for i := 0; i < b.N; i++ {`)
 			p.P(`for i := 0; i < b.N; i++ {`)
 			p.In()
 			p.In()
-			p.P(`data, err := `, protoPkg.Use(), `.Marshal(pops[i%10000])`)
+			p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(pops[i%10000])`)
 			p.P(`if err != nil {`)
 			p.P(`if err != nil {`)
 			p.In()
 			p.In()
 			p.P(`panic(err)`)
 			p.P(`panic(err)`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
-			p.P(`total += len(data)`)
+			p.P(`total += len(dAtA)`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			p.P(`b.SetBytes(int64(total / b.N))`)
 			p.P(`b.SetBytes(int64(total / b.N))`)
@@ -423,13 +425,13 @@ func (p *testProto) Generate(imports generator.PluginImports, file *generator.Fi
 			p.P(`datas := make([][]byte, 10000)`)
 			p.P(`datas := make([][]byte, 10000)`)
 			p.P(`for i := 0; i < 10000; i++ {`)
 			p.P(`for i := 0; i < 10000; i++ {`)
 			p.In()
 			p.In()
-			p.P(`data, err := `, protoPkg.Use(), `.Marshal(NewPopulated`, ccTypeName, `(popr, false))`)
+			p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(NewPopulated`, ccTypeName, `(popr, false))`)
 			p.P(`if err != nil {`)
 			p.P(`if err != nil {`)
 			p.In()
 			p.In()
 			p.P(`panic(err)`)
 			p.P(`panic(err)`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
-			p.P(`datas[i] = data`)
+			p.P(`datas[i] = dAtA`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			p.P(`msg := &`, ccTypeName, `{}`)
 			p.P(`msg := &`, ccTypeName, `{}`)
@@ -543,9 +545,9 @@ func (p *testText) Generate(imports generator.PluginImports, file *generator.Fil
 			p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`)
 			p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`)
 			p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`)
 			p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`)
 			p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`)
 			p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`)
-			p.P(`data := `, protoPkg.Use(), `.MarshalTextString(p)`)
+			p.P(`dAtA := `, protoPkg.Use(), `.MarshalTextString(p)`)
 			p.P(`msg := &`, ccTypeName, `{}`)
 			p.P(`msg := &`, ccTypeName, `{}`)
-			p.P(`if err := `, protoPkg.Use(), `.UnmarshalText(data, msg); err != nil {`)
+			p.P(`if err := `, protoPkg.Use(), `.UnmarshalText(dAtA, msg); err != nil {`)
 			p.In()
 			p.In()
 			p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`)
 			p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`)
 			p.Out()
 			p.Out()
@@ -571,9 +573,9 @@ func (p *testText) Generate(imports generator.PluginImports, file *generator.Fil
 			p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`)
 			p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`)
 			p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`)
 			p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`)
 			p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`)
 			p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`)
-			p.P(`data := `, protoPkg.Use(), `.CompactTextString(p)`)
+			p.P(`dAtA := `, protoPkg.Use(), `.CompactTextString(p)`)
 			p.P(`msg := &`, ccTypeName, `{}`)
 			p.P(`msg := &`, ccTypeName, `{}`)
-			p.P(`if err := `, protoPkg.Use(), `.UnmarshalText(data, msg); err != nil {`)
+			p.P(`if err := `, protoPkg.Use(), `.UnmarshalText(dAtA, msg); err != nil {`)
 			p.In()
 			p.In()
 			p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`)
 			p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`)
 			p.Out()
 			p.Out()

+ 3 - 1
vendor/github.com/gogo/protobuf/plugin/union/union.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without

+ 3 - 1
vendor/github.com/gogo/protobuf/plugin/union/uniontest.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without

+ 194 - 74
vendor/github.com/gogo/protobuf/plugin/unmarshal/unmarshal.go

@@ -1,4 +1,6 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
 // http://github.com/gogo/protobuf
 // http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
@@ -73,8 +75,8 @@ The following message:
 
 
 given to the unmarshal plugin, will generate the following code:
 given to the unmarshal plugin, will generate the following code:
 
 
-  func (m *B) Unmarshal(data []byte) error {
-	l := len(data)
+  func (m *B) Unmarshal(dAtA []byte) error {
+	l := len(dAtA)
 	iNdEx := 0
 	iNdEx := 0
 	for iNdEx < l {
 	for iNdEx < l {
 		var wire uint64
 		var wire uint64
@@ -82,7 +84,7 @@ given to the unmarshal plugin, will generate the following code:
 			if iNdEx >= l {
 			if iNdEx >= l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			b := data[iNdEx]
+			b := dAtA[iNdEx]
 			iNdEx++
 			iNdEx++
 			wire |= (uint64(b) & 0x7F) << shift
 			wire |= (uint64(b) & 0x7F) << shift
 			if b < 0x80 {
 			if b < 0x80 {
@@ -101,7 +103,7 @@ given to the unmarshal plugin, will generate the following code:
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				msglen |= (int(b) & 0x7F) << shift
 				msglen |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -112,7 +114,7 @@ given to the unmarshal plugin, will generate the following code:
 			if postIndex > l {
 			if postIndex > l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			if err := m.A.Unmarshal(data[iNdEx:postIndex]); err != nil {
+			if err := m.A.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
 				return err
 				return err
 			}
 			}
 			iNdEx = postIndex
 			iNdEx = postIndex
@@ -125,7 +127,7 @@ given to the unmarshal plugin, will generate the following code:
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return io.ErrUnexpectedEOF
 					return io.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				byteLen |= (int(b) & 0x7F) << shift
 				byteLen |= (int(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -137,7 +139,7 @@ given to the unmarshal plugin, will generate the following code:
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
 			m.G = append(m.G, github_com_gogo_protobuf_test_custom.Uint128{})
 			m.G = append(m.G, github_com_gogo_protobuf_test_custom.Uint128{})
-			if err := m.G[len(m.G)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
+			if err := m.G[len(m.G)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
 				return err
 				return err
 			}
 			}
 			iNdEx = postIndex
 			iNdEx = postIndex
@@ -151,14 +153,14 @@ given to the unmarshal plugin, will generate the following code:
 				}
 				}
 			}
 			}
 			iNdEx -= sizeOfWire
 			iNdEx -= sizeOfWire
-			skippy, err := skip(data[iNdEx:])
+			skippy, err := skip(dAtA[iNdEx:])
 			if err != nil {
 			if err != nil {
 				return err
 				return err
 			}
 			}
 			if (iNdEx + skippy) > l {
 			if (iNdEx + skippy) > l {
 				return io.ErrUnexpectedEOF
 				return io.ErrUnexpectedEOF
 			}
 			}
-			m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
+			m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
 			iNdEx += skippy
 			iNdEx += skippy
 		}
 		}
 	}
 	}
@@ -191,6 +193,7 @@ type unmarshal struct {
 	ioPkg      generator.Single
 	ioPkg      generator.Single
 	mathPkg    generator.Single
 	mathPkg    generator.Single
 	unsafePkg  generator.Single
 	unsafePkg  generator.Single
+	typesPkg   generator.Single
 	localName  string
 	localName  string
 }
 }
 
 
@@ -226,7 +229,7 @@ func (p *unmarshal) decodeVarint(varName string, typName string) {
 	p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`)
 	p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`)
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
-	p.P(`b := data[iNdEx]`)
+	p.P(`b := dAtA[iNdEx]`)
 	p.P(`iNdEx++`)
 	p.P(`iNdEx++`)
 	p.P(varName, ` |= (`, typName, `(b) & 0x7F) << shift`)
 	p.P(varName, ` |= (`, typName, `(b) & 0x7F) << shift`)
 	p.P(`if b < 0x80 {`)
 	p.P(`if b < 0x80 {`)
@@ -245,10 +248,10 @@ func (p *unmarshal) decodeFixed32(varName string, typeName string) {
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
 	p.P(`iNdEx += 4`)
 	p.P(`iNdEx += 4`)
-	p.P(varName, ` = `, typeName, `(data[iNdEx-4])`)
-	p.P(varName, ` |= `, typeName, `(data[iNdEx-3]) << 8`)
-	p.P(varName, ` |= `, typeName, `(data[iNdEx-2]) << 16`)
-	p.P(varName, ` |= `, typeName, `(data[iNdEx-1]) << 24`)
+	p.P(varName, ` = `, typeName, `(dAtA[iNdEx-4])`)
+	p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-3]) << 8`)
+	p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-2]) << 16`)
+	p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-1]) << 24`)
 }
 }
 
 
 func (p *unmarshal) unsafeFixed32(varName string, typeName string) {
 func (p *unmarshal) unsafeFixed32(varName string, typeName string) {
@@ -257,7 +260,7 @@ func (p *unmarshal) unsafeFixed32(varName string, typeName string) {
 	p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`)
 	p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`)
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
-	p.P(varName, ` = *(*`, typeName, `)(`, p.unsafePkg.Use(), `.Pointer(&data[iNdEx]))`)
+	p.P(varName, ` = *(*`, typeName, `)(`, p.unsafePkg.Use(), `.Pointer(&dAtA[iNdEx]))`)
 	p.P(`iNdEx += 4`)
 	p.P(`iNdEx += 4`)
 }
 }
 
 
@@ -268,14 +271,14 @@ func (p *unmarshal) decodeFixed64(varName string, typeName string) {
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
 	p.P(`iNdEx += 8`)
 	p.P(`iNdEx += 8`)
-	p.P(varName, ` = `, typeName, `(data[iNdEx-8])`)
-	p.P(varName, ` |= `, typeName, `(data[iNdEx-7]) << 8`)
-	p.P(varName, ` |= `, typeName, `(data[iNdEx-6]) << 16`)
-	p.P(varName, ` |= `, typeName, `(data[iNdEx-5]) << 24`)
-	p.P(varName, ` |= `, typeName, `(data[iNdEx-4]) << 32`)
-	p.P(varName, ` |= `, typeName, `(data[iNdEx-3]) << 40`)
-	p.P(varName, ` |= `, typeName, `(data[iNdEx-2]) << 48`)
-	p.P(varName, ` |= `, typeName, `(data[iNdEx-1]) << 56`)
+	p.P(varName, ` = `, typeName, `(dAtA[iNdEx-8])`)
+	p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-7]) << 8`)
+	p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-6]) << 16`)
+	p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-5]) << 24`)
+	p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-4]) << 32`)
+	p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-3]) << 40`)
+	p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-2]) << 48`)
+	p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-1]) << 56`)
 }
 }
 
 
 func (p *unmarshal) unsafeFixed64(varName string, typeName string) {
 func (p *unmarshal) unsafeFixed64(varName string, typeName string) {
@@ -284,11 +287,11 @@ func (p *unmarshal) unsafeFixed64(varName string, typeName string) {
 	p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`)
 	p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`)
 	p.Out()
 	p.Out()
 	p.P(`}`)
 	p.P(`}`)
-	p.P(varName, ` = *(*`, typeName, `)(`, p.unsafePkg.Use(), `.Pointer(&data[iNdEx]))`)
+	p.P(varName, ` = *(*`, typeName, `)(`, p.unsafePkg.Use(), `.Pointer(&dAtA[iNdEx]))`)
 	p.P(`iNdEx += 8`)
 	p.P(`iNdEx += 8`)
 }
 }
 
 
-func (p *unmarshal) mapField(varName string, field *descriptor.FieldDescriptorProto) {
+func (p *unmarshal) mapField(varName string, customType bool, field *descriptor.FieldDescriptorProto) {
 	switch field.GetType() {
 	switch field.GetType() {
 	case descriptor.FieldDescriptorProto_TYPE_DOUBLE:
 	case descriptor.FieldDescriptorProto_TYPE_DOUBLE:
 		p.P(`var `, varName, `temp uint64`)
 		p.P(`var `, varName, `temp uint64`)
@@ -334,7 +337,7 @@ func (p *unmarshal) mapField(varName string, field *descriptor.FieldDescriptorPr
 		p.P(`}`)
 		p.P(`}`)
 		cast, _ := p.GoType(nil, field)
 		cast, _ := p.GoType(nil, field)
 		cast = strings.Replace(cast, "*", "", 1)
 		cast = strings.Replace(cast, "*", "", 1)
-		p.P(varName, ` := `, cast, `(data[iNdEx:postStringIndex`, varName, `])`)
+		p.P(varName, ` := `, cast, `(dAtA[iNdEx:postStringIndex`, varName, `])`)
 		p.P(`iNdEx = postStringIndex`, varName)
 		p.P(`iNdEx = postStringIndex`, varName)
 	case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
 	case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
 		p.P(`var mapmsglen int`)
 		p.P(`var mapmsglen int`)
@@ -357,8 +360,17 @@ func (p *unmarshal) mapField(varName string, field *descriptor.FieldDescriptorPr
 		p.P(`}`)
 		p.P(`}`)
 		desc := p.ObjectNamed(field.GetTypeName())
 		desc := p.ObjectNamed(field.GetTypeName())
 		msgname := p.TypeName(desc)
 		msgname := p.TypeName(desc)
-		p.P(varName, ` := &`, msgname, `{}`)
-		p.P(`if err := `, varName, `.Unmarshal(data[iNdEx:postmsgIndex]); err != nil {`)
+		buf := `dAtA[iNdEx:postmsgIndex]`
+		if gogoproto.IsStdTime(field) {
+			p.P(varName, ` := new(time.Time)`)
+			p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(`, varName, `, `, buf, `); err != nil {`)
+		} else if gogoproto.IsStdDuration(field) {
+			p.P(varName, ` := new(time.Duration)`)
+			p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(`, varName, `, `, buf, `); err != nil {`)
+		} else {
+			p.P(varName, ` := &`, msgname, `{}`)
+			p.P(`if err := `, varName, `.Unmarshal(`, buf, `); err != nil {`)
+		}
 		p.In()
 		p.In()
 		p.P(`return err`)
 		p.P(`return err`)
 		p.Out()
 		p.Out()
@@ -379,8 +391,22 @@ func (p *unmarshal) mapField(varName string, field *descriptor.FieldDescriptorPr
 		p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`)
 		p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`)
 		p.Out()
 		p.Out()
 		p.P(`}`)
 		p.P(`}`)
-		p.P(varName, ` := make([]byte, mapbyteLen)`)
-		p.P(`copy(`, varName, `, data[iNdEx:postbytesIndex])`)
+		if customType {
+			_, ctyp, err := generator.GetCustomType(field)
+			if err != nil {
+				panic(err)
+			}
+			p.P(`var `, varName, `1 `, ctyp)
+			p.P(`var `, varName, ` = &`, varName, `1`)
+			p.P(`if err := `, varName, `.Unmarshal(dAtA[iNdEx:postbytesIndex]); err != nil {`)
+			p.In()
+			p.P(`return err`)
+			p.Out()
+			p.P(`}`)
+		} else {
+			p.P(varName, ` := make([]byte, mapbyteLen)`)
+			p.P(`copy(`, varName, `, dAtA[iNdEx:postbytesIndex])`)
+		}
 		p.P(`iNdEx = postbytesIndex`)
 		p.P(`iNdEx = postbytesIndex`)
 	case descriptor.FieldDescriptorProto_TYPE_UINT32:
 	case descriptor.FieldDescriptorProto_TYPE_UINT32:
 		p.P(`var `, varName, ` uint32`)
 		p.P(`var `, varName, ` uint32`)
@@ -640,13 +666,13 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
 		p.Out()
 		p.Out()
 		p.P(`}`)
 		p.P(`}`)
 		if oneof {
 		if oneof {
-			p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{`, typ, `(data[iNdEx:postIndex])}`)
+			p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{`, typ, `(dAtA[iNdEx:postIndex])}`)
 		} else if repeated {
 		} else if repeated {
-			p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, typ, `(data[iNdEx:postIndex]))`)
+			p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, typ, `(dAtA[iNdEx:postIndex]))`)
 		} else if proto3 || !nullable {
 		} else if proto3 || !nullable {
-			p.P(`m.`, fieldname, ` = `, typ, `(data[iNdEx:postIndex])`)
+			p.P(`m.`, fieldname, ` = `, typ, `(dAtA[iNdEx:postIndex])`)
 		} else {
 		} else {
-			p.P(`s := `, typ, `(data[iNdEx:postIndex])`)
+			p.P(`s := `, typ, `(dAtA[iNdEx:postIndex])`)
 			p.P(`m.`, fieldname, ` = &s`)
 			p.P(`m.`, fieldname, ` = &s`)
 		}
 		}
 		p.P(`iNdEx = postIndex`)
 		p.P(`iNdEx = postIndex`)
@@ -669,8 +695,27 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
 		p.Out()
 		p.Out()
 		p.P(`}`)
 		p.P(`}`)
 		if oneof {
 		if oneof {
-			p.P(`v := &`, msgname, `{}`)
-			p.P(`if err := v.Unmarshal(data[iNdEx:postIndex]); err != nil {`)
+			buf := `dAtA[iNdEx:postIndex]`
+			if gogoproto.IsStdTime(field) {
+				if nullable {
+					p.P(`v := new(time.Time)`)
+					p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(v, `, buf, `); err != nil {`)
+				} else {
+					p.P(`v := time.Time{}`)
+					p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(&v, `, buf, `); err != nil {`)
+				}
+			} else if gogoproto.IsStdDuration(field) {
+				if nullable {
+					p.P(`v := new(time.Duration)`)
+					p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(v, `, buf, `); err != nil {`)
+				} else {
+					p.P(`v := time.Duration(0)`)
+					p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(&v, `, buf, `); err != nil {`)
+				}
+			} else {
+				p.P(`v := &`, msgname, `{}`)
+				p.P(`if err := v.Unmarshal(`, buf, `); err != nil {`)
+			}
 			p.In()
 			p.In()
 			p.P(`return err`)
 			p.P(`return err`)
 			p.Out()
 			p.Out()
@@ -694,13 +739,13 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
 			p.RecordTypeUse(m.ValueAliasField.GetTypeName())
 			p.RecordTypeUse(m.ValueAliasField.GetTypeName())
 
 
 			nullable, valuegoTyp, valuegoAliasTyp = generator.GoMapValueTypes(field, m.ValueField, valuegoTyp, valuegoAliasTyp)
 			nullable, valuegoTyp, valuegoAliasTyp = generator.GoMapValueTypes(field, m.ValueField, valuegoTyp, valuegoAliasTyp)
+			if gogoproto.IsStdTime(field) || gogoproto.IsStdDuration(field) {
+				valuegoTyp = valuegoAliasTyp
+			}
 
 
 			p.P(`var keykey uint64`)
 			p.P(`var keykey uint64`)
 			p.decodeVarint("keykey", "uint64")
 			p.decodeVarint("keykey", "uint64")
-			p.mapField("mapkey", m.KeyAliasField)
-			p.P(`var valuekey uint64`)
-			p.decodeVarint("valuekey", "uint64")
-			p.mapField("mapvalue", m.ValueAliasField)
+			p.mapField("mapkey", false, m.KeyAliasField)
 			p.P(`if m.`, fieldname, ` == nil {`)
 			p.P(`if m.`, fieldname, ` == nil {`)
 			p.In()
 			p.In()
 			p.P(`m.`, fieldname, ` = make(`, m.GoType, `)`)
 			p.P(`m.`, fieldname, ` = make(`, m.GoType, `)`)
@@ -713,20 +758,76 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
 				s += `[` + keygoAliasTyp + `(mapkey)]`
 				s += `[` + keygoAliasTyp + `(mapkey)]`
 			}
 			}
 			v := `mapvalue`
 			v := `mapvalue`
-			if m.ValueField.IsMessage() && !nullable {
+			if (m.ValueField.IsMessage() || gogoproto.IsCustomType(field)) && !nullable {
 				v = `*` + v
 				v = `*` + v
 			}
 			}
 			if valuegoTyp != valuegoAliasTyp {
 			if valuegoTyp != valuegoAliasTyp {
 				v = `((` + valuegoAliasTyp + `)(` + v + `))`
 				v = `((` + valuegoAliasTyp + `)(` + v + `))`
 			}
 			}
+			p.P(`if iNdEx < postIndex {`)
+			p.In()
+			p.P(`var valuekey uint64`)
+			p.decodeVarint("valuekey", "uint64")
+			p.mapField("mapvalue", gogoproto.IsCustomType(field), m.ValueAliasField)
 			p.P(s, ` = `, v)
 			p.P(s, ` = `, v)
+			p.Out()
+			p.P(`} else {`)
+			p.In()
+			if gogoproto.IsStdTime(field) {
+				p.P(`var mapvalue = new(time.Time)`)
+				if nullable {
+					p.P(s, ` = mapvalue`)
+				} else {
+					p.P(s, ` = *mapvalue`)
+				}
+			} else if gogoproto.IsStdDuration(field) {
+				p.P(`var mapvalue = new(time.Duration)`)
+				if nullable {
+					p.P(s, ` = mapvalue`)
+				} else {
+					p.P(s, ` = *mapvalue`)
+				}
+			} else {
+				p.P(`var mapvalue `, valuegoAliasTyp)
+				p.P(s, ` = mapvalue`)
+			}
+			p.Out()
+			p.P(`}`)
 		} else if repeated {
 		} else if repeated {
-			if nullable {
+			if gogoproto.IsStdTime(field) {
+				if nullable {
+					p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, new(time.Time))`)
+				} else {
+					p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, time.Time{})`)
+				}
+			} else if gogoproto.IsStdDuration(field) {
+				if nullable {
+					p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, new(time.Duration))`)
+				} else {
+					p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, time.Duration(0))`)
+				}
+			} else if nullable {
 				p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, &`, msgname, `{})`)
 				p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, &`, msgname, `{})`)
 			} else {
 			} else {
 				p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, msgname, `{})`)
 				p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, msgname, `{})`)
 			}
 			}
-			p.P(`if err := m.`, fieldname, `[len(m.`, fieldname, `)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {`)
+			varName := `m.` + fieldname + `[len(m.` + fieldname + `)-1]`
+			buf := `dAtA[iNdEx:postIndex]`
+			if gogoproto.IsStdTime(field) {
+				if nullable {
+					p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(`, varName, `,`, buf, `); err != nil {`)
+				} else {
+					p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(&(`, varName, `),`, buf, `); err != nil {`)
+				}
+			} else if gogoproto.IsStdDuration(field) {
+				if nullable {
+					p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(`, varName, `,`, buf, `); err != nil {`)
+				} else {
+					p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(&(`, varName, `),`, buf, `); err != nil {`)
+				}
+			} else {
+				p.P(`if err := `, varName, `.Unmarshal(`, buf, `); err != nil {`)
+			}
 			p.In()
 			p.In()
 			p.P(`return err`)
 			p.P(`return err`)
 			p.Out()
 			p.Out()
@@ -734,16 +835,34 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
 		} else if nullable {
 		} else if nullable {
 			p.P(`if m.`, fieldname, ` == nil {`)
 			p.P(`if m.`, fieldname, ` == nil {`)
 			p.In()
 			p.In()
-			p.P(`m.`, fieldname, ` = &`, msgname, `{}`)
+			if gogoproto.IsStdTime(field) {
+				p.P(`m.`, fieldname, ` = new(time.Time)`)
+			} else if gogoproto.IsStdDuration(field) {
+				p.P(`m.`, fieldname, ` = new(time.Duration)`)
+			} else {
+				p.P(`m.`, fieldname, ` = &`, msgname, `{}`)
+			}
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
-			p.P(`if err := m.`, fieldname, `.Unmarshal(data[iNdEx:postIndex]); err != nil {`)
+			if gogoproto.IsStdTime(field) {
+				p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(m.`, fieldname, `, dAtA[iNdEx:postIndex]); err != nil {`)
+			} else if gogoproto.IsStdDuration(field) {
+				p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(m.`, fieldname, `, dAtA[iNdEx:postIndex]); err != nil {`)
+			} else {
+				p.P(`if err := m.`, fieldname, `.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`)
+			}
 			p.In()
 			p.In()
 			p.P(`return err`)
 			p.P(`return err`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 		} else {
 		} else {
-			p.P(`if err := m.`, fieldname, `.Unmarshal(data[iNdEx:postIndex]); err != nil {`)
+			if gogoproto.IsStdTime(field) {
+				p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(&m.`, fieldname, `, dAtA[iNdEx:postIndex]); err != nil {`)
+			} else if gogoproto.IsStdDuration(field) {
+				p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(&m.`, fieldname, `, dAtA[iNdEx:postIndex]); err != nil {`)
+			} else {
+				p.P(`if err := m.`, fieldname, `.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`)
+			}
 			p.In()
 			p.In()
 			p.P(`return err`)
 			p.P(`return err`)
 			p.Out()
 			p.Out()
@@ -767,13 +886,13 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
 		if !gogoproto.IsCustomType(field) {
 		if !gogoproto.IsCustomType(field) {
 			if oneof {
 			if oneof {
 				p.P(`v := make([]byte, postIndex-iNdEx)`)
 				p.P(`v := make([]byte, postIndex-iNdEx)`)
-				p.P(`copy(v, data[iNdEx:postIndex])`)
+				p.P(`copy(v, dAtA[iNdEx:postIndex])`)
 				p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`)
 				p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`)
 			} else if repeated {
 			} else if repeated {
 				p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, make([]byte, postIndex-iNdEx))`)
 				p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, make([]byte, postIndex-iNdEx))`)
-				p.P(`copy(m.`, fieldname, `[len(m.`, fieldname, `)-1], data[iNdEx:postIndex])`)
+				p.P(`copy(m.`, fieldname, `[len(m.`, fieldname, `)-1], dAtA[iNdEx:postIndex])`)
 			} else {
 			} else {
-				p.P(`m.`, fieldname, ` = append(m.`, fieldname, `[:0] , data[iNdEx:postIndex]...)`)
+				p.P(`m.`, fieldname, ` = append(m.`, fieldname, `[:0] , dAtA[iNdEx:postIndex]...)`)
 				p.P(`if m.`, fieldname, ` == nil {`)
 				p.P(`if m.`, fieldname, ` == nil {`)
 				p.In()
 				p.In()
 				p.P(`m.`, fieldname, ` = []byte{}`)
 				p.P(`m.`, fieldname, ` = []byte{}`)
@@ -788,7 +907,7 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
 			if oneof {
 			if oneof {
 				p.P(`var vv `, ctyp)
 				p.P(`var vv `, ctyp)
 				p.P(`v := &vv`)
 				p.P(`v := &vv`)
-				p.P(`if err := v.Unmarshal(data[iNdEx:postIndex]); err != nil {`)
+				p.P(`if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`)
 				p.In()
 				p.In()
 				p.P(`return err`)
 				p.P(`return err`)
 				p.Out()
 				p.Out()
@@ -797,7 +916,7 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
 			} else if repeated {
 			} else if repeated {
 				p.P(`var v `, ctyp)
 				p.P(`var v `, ctyp)
 				p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`)
 				p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`)
-				p.P(`if err := m.`, fieldname, `[len(m.`, fieldname, `)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {`)
+				p.P(`if err := m.`, fieldname, `[len(m.`, fieldname, `)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`)
 				p.In()
 				p.In()
 				p.P(`return err`)
 				p.P(`return err`)
 				p.Out()
 				p.Out()
@@ -805,13 +924,13 @@ func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descrip
 			} else if nullable {
 			} else if nullable {
 				p.P(`var v `, ctyp)
 				p.P(`var v `, ctyp)
 				p.P(`m.`, fieldname, ` = &v`)
 				p.P(`m.`, fieldname, ` = &v`)
-				p.P(`if err := m.`, fieldname, `.Unmarshal(data[iNdEx:postIndex]); err != nil {`)
+				p.P(`if err := m.`, fieldname, `.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`)
 				p.In()
 				p.In()
 				p.P(`return err`)
 				p.P(`return err`)
 				p.Out()
 				p.Out()
 				p.P(`}`)
 				p.P(`}`)
 			} else {
 			} else {
-				p.P(`if err := m.`, fieldname, `.Unmarshal(data[iNdEx:postIndex]); err != nil {`)
+				p.P(`if err := m.`, fieldname, `.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`)
 				p.In()
 				p.In()
 				p.P(`return err`)
 				p.P(`return err`)
 				p.Out()
 				p.Out()
@@ -968,6 +1087,7 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
 	p.ioPkg = p.NewImport("io")
 	p.ioPkg = p.NewImport("io")
 	p.mathPkg = p.NewImport("math")
 	p.mathPkg = p.NewImport("math")
 	p.unsafePkg = p.NewImport("unsafe")
 	p.unsafePkg = p.NewImport("unsafe")
+	p.typesPkg = p.NewImport("github.com/gogo/protobuf/types")
 	fmtPkg := p.NewImport("fmt")
 	fmtPkg := p.NewImport("fmt")
 	protoPkg := p.NewImport("github.com/gogo/protobuf/proto")
 	protoPkg := p.NewImport("github.com/gogo/protobuf/proto")
 	if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) {
 	if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) {
@@ -1008,12 +1128,12 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
 		}
 		}
 		rfCount := len(rfMap)
 		rfCount := len(rfMap)
 
 
-		p.P(`func (m *`, ccTypeName, `) Unmarshal(data []byte) error {`)
+		p.P(`func (m *`, ccTypeName, `) Unmarshal(dAtA []byte) error {`)
 		p.In()
 		p.In()
 		if rfCount > 0 {
 		if rfCount > 0 {
 			p.P(`var hasFields [`, strconv.Itoa(1+(rfCount-1)/64), `]uint64`)
 			p.P(`var hasFields [`, strconv.Itoa(1+(rfCount-1)/64), `]uint64`)
 		}
 		}
-		p.P(`l := len(data)`)
+		p.P(`l := len(dAtA)`)
 		p.P(`iNdEx := 0`)
 		p.P(`iNdEx := 0`)
 		p.P(`for iNdEx < l {`)
 		p.P(`for iNdEx < l {`)
 		p.In()
 		p.In()
@@ -1044,12 +1164,16 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
 			if field.OneofIndex != nil {
 			if field.OneofIndex != nil {
 				errFieldname = p.GetOneOfFieldName(message, field)
 				errFieldname = p.GetOneOfFieldName(message, field)
 			}
 			}
-			packed := field.IsPacked()
+			possiblyPacked := field.IsScalar() && field.IsRepeated()
 			p.P(`case `, strconv.Itoa(int(field.GetNumber())), `:`)
 			p.P(`case `, strconv.Itoa(int(field.GetNumber())), `:`)
 			p.In()
 			p.In()
 			wireType := field.WireType()
 			wireType := field.WireType()
-			if packed {
-				p.P(`if wireType == `, strconv.Itoa(proto.WireBytes), `{`)
+			if possiblyPacked {
+				p.P(`if wireType == `, strconv.Itoa(wireType), `{`)
+				p.In()
+				p.field(file, message, field, fieldname, false)
+				p.Out()
+				p.P(`} else if wireType == `, strconv.Itoa(proto.WireBytes), `{`)
 				p.In()
 				p.In()
 				p.P(`var packedLen int`)
 				p.P(`var packedLen int`)
 				p.decodeVarint("packedLen", "int")
 				p.decodeVarint("packedLen", "int")
@@ -1070,10 +1194,6 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
 				p.Out()
 				p.Out()
 				p.P(`}`)
 				p.P(`}`)
 				p.Out()
 				p.Out()
-				p.P(`} else if wireType == `, strconv.Itoa(wireType), `{`)
-				p.In()
-				p.field(file, message, field, fieldname, false)
-				p.Out()
 				p.P(`} else {`)
 				p.P(`} else {`)
 				p.In()
 				p.In()
 				p.P(`return ` + fmtPkg.Use() + `.Errorf("proto: wrong wireType = %d for field ` + errFieldname + `", wireType)`)
 				p.P(`return ` + fmtPkg.Use() + `.Errorf("proto: wrong wireType = %d for field ` + errFieldname + `", wireType)`)
@@ -1119,7 +1239,7 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
 			p.P(`iNdEx-=sizeOfWire`)
 			p.P(`iNdEx-=sizeOfWire`)
-			p.P(`skippy, err := skip`, p.localName+`(data[iNdEx:])`)
+			p.P(`skippy, err := skip`, p.localName+`(dAtA[iNdEx:])`)
 			p.P(`if err != nil {`)
 			p.P(`if err != nil {`)
 			p.In()
 			p.In()
 			p.P(`return err`)
 			p.P(`return err`)
@@ -1135,14 +1255,14 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
 			p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`)
 			p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`)
 			p.Out()
 			p.Out()
 			p.P(`}`)
 			p.P(`}`)
-			p.P(protoPkg.Use(), `.AppendExtension(m, int32(fieldNum), data[iNdEx:iNdEx+skippy])`)
+			p.P(protoPkg.Use(), `.AppendExtension(m, int32(fieldNum), dAtA[iNdEx:iNdEx+skippy])`)
 			p.P(`iNdEx += skippy`)
 			p.P(`iNdEx += skippy`)
 			p.Out()
 			p.Out()
 			p.P(`} else {`)
 			p.P(`} else {`)
 			p.In()
 			p.In()
 		}
 		}
 		p.P(`iNdEx=preIndex`)
 		p.P(`iNdEx=preIndex`)
-		p.P(`skippy, err := skip`, p.localName, `(data[iNdEx:])`)
+		p.P(`skippy, err := skip`, p.localName, `(dAtA[iNdEx:])`)
 		p.P(`if err != nil {`)
 		p.P(`if err != nil {`)
 		p.In()
 		p.In()
 		p.P(`return err`)
 		p.P(`return err`)
@@ -1159,7 +1279,7 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
 		p.Out()
 		p.Out()
 		p.P(`}`)
 		p.P(`}`)
 		if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) {
 		if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) {
-			p.P(`m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)`)
+			p.P(`m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)`)
 		}
 		}
 		p.P(`iNdEx += skippy`)
 		p.P(`iNdEx += skippy`)
 		p.Out()
 		p.Out()
@@ -1206,8 +1326,8 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
 		return
 		return
 	}
 	}
 
 
-	p.P(`func skip` + p.localName + `(data []byte) (n int, err error) {
-		l := len(data)
+	p.P(`func skip` + p.localName + `(dAtA []byte) (n int, err error) {
+		l := len(dAtA)
 		iNdEx := 0
 		iNdEx := 0
 		for iNdEx < l {
 		for iNdEx < l {
 			var wire uint64
 			var wire uint64
@@ -1218,7 +1338,7 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
 				if iNdEx >= l {
 				if iNdEx >= l {
 					return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF
 					return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF
 				}
 				}
-				b := data[iNdEx]
+				b := dAtA[iNdEx]
 				iNdEx++
 				iNdEx++
 				wire |= (uint64(b) & 0x7F) << shift
 				wire |= (uint64(b) & 0x7F) << shift
 				if b < 0x80 {
 				if b < 0x80 {
@@ -1236,7 +1356,7 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
 						return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF
 						return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF
 					}
 					}
 					iNdEx++
 					iNdEx++
-					if data[iNdEx-1] < 0x80 {
+					if dAtA[iNdEx-1] < 0x80 {
 						break
 						break
 					}
 					}
 				}
 				}
@@ -1253,7 +1373,7 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
 					if iNdEx >= l {
 					if iNdEx >= l {
 						return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF
 						return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF
 					}
 					}
-					b := data[iNdEx]
+					b := dAtA[iNdEx]
 					iNdEx++
 					iNdEx++
 					length |= (int(b) & 0x7F) << shift
 					length |= (int(b) & 0x7F) << shift
 					if b < 0x80 {
 					if b < 0x80 {
@@ -1276,7 +1396,7 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
 						if iNdEx >= l {
 						if iNdEx >= l {
 							return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF
 							return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF
 						}
 						}
-						b := data[iNdEx]
+						b := dAtA[iNdEx]
 						iNdEx++
 						iNdEx++
 						innerWire |= (uint64(b) & 0x7F) << shift
 						innerWire |= (uint64(b) & 0x7F) << shift
 						if b < 0x80 {
 						if b < 0x80 {
@@ -1287,7 +1407,7 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
 					if innerWireType == 4 {
 					if innerWireType == 4 {
 						break
 						break
 					}
 					}
-					next, err := skip` + p.localName + `(data[start:])
+					next, err := skip` + p.localName + `(dAtA[start:])
 					if err != nil {
 					if err != nil {
 						return 0, err
 						return 0, err
 					}
 					}

+ 0 - 36
vendor/github.com/gogo/protobuf/proto/LICENSE

@@ -1,36 +0,0 @@
-Extensions for Protocol Buffers to create more go like structures.
-
-Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-http://github.com/gogo/protobuf/gogoproto
-
-Go support for Protocol Buffers - Google's data interchange format
-
-Copyright 2010 The Go Authors.  All rights reserved.
-https://github.com/golang/protobuf
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-    * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-    * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-

+ 43 - 0
vendor/github.com/gogo/protobuf/proto/Makefile

@@ -0,0 +1,43 @@
+# Go support for Protocol Buffers - Google's data interchange format
+#
+# Copyright 2010 The Go Authors.  All rights reserved.
+# https://github.com/golang/protobuf
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+install:
+	go install
+
+test: install generate-test-pbs
+	go test
+
+
+generate-test-pbs:
+	make install
+	make -C testdata
+	protoc-min-version --version="3.0.0" --proto_path=.:../../../../:../protobuf --gogo_out=Mtestdata/test.proto=github.com/gogo/protobuf/proto/testdata,Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types:. proto3_proto/proto3.proto
+	make

+ 2278 - 0
vendor/github.com/gogo/protobuf/proto/all_test.go

@@ -0,0 +1,2278 @@
+// Go support for Protocol Buffers - Google's data interchange format
+//
+// Copyright 2010 The Go Authors.  All rights reserved.
+// https://github.com/golang/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package proto_test
+
+import (
+	"bytes"
+	"encoding/json"
+	"errors"
+	"fmt"
+	"math"
+	"math/rand"
+	"reflect"
+	"runtime/debug"
+	"strings"
+	"testing"
+	"time"
+
+	. "github.com/gogo/protobuf/proto"
+	. "github.com/gogo/protobuf/proto/testdata"
+)
+
+var globalO *Buffer
+
+func old() *Buffer {
+	if globalO == nil {
+		globalO = NewBuffer(nil)
+	}
+	globalO.Reset()
+	return globalO
+}
+
+func equalbytes(b1, b2 []byte, t *testing.T) {
+	if len(b1) != len(b2) {
+		t.Errorf("wrong lengths: 2*%d != %d", len(b1), len(b2))
+		return
+	}
+	for i := 0; i < len(b1); i++ {
+		if b1[i] != b2[i] {
+			t.Errorf("bad byte[%d]:%x %x: %s %s", i, b1[i], b2[i], b1, b2)
+		}
+	}
+}
+
+func initGoTestField() *GoTestField {
+	f := new(GoTestField)
+	f.Label = String("label")
+	f.Type = String("type")
+	return f
+}
+
+// These are all structurally equivalent but the tag numbers differ.
+// (It's remarkable that required, optional, and repeated all have
+// 8 letters.)
+func initGoTest_RequiredGroup() *GoTest_RequiredGroup {
+	return &GoTest_RequiredGroup{
+		RequiredField: String("required"),
+	}
+}
+
+func initGoTest_OptionalGroup() *GoTest_OptionalGroup {
+	return &GoTest_OptionalGroup{
+		RequiredField: String("optional"),
+	}
+}
+
+func initGoTest_RepeatedGroup() *GoTest_RepeatedGroup {
+	return &GoTest_RepeatedGroup{
+		RequiredField: String("repeated"),
+	}
+}
+
+func initGoTest(setdefaults bool) *GoTest {
+	pb := new(GoTest)
+	if setdefaults {
+		pb.F_BoolDefaulted = Bool(Default_GoTest_F_BoolDefaulted)
+		pb.F_Int32Defaulted = Int32(Default_GoTest_F_Int32Defaulted)
+		pb.F_Int64Defaulted = Int64(Default_GoTest_F_Int64Defaulted)
+		pb.F_Fixed32Defaulted = Uint32(Default_GoTest_F_Fixed32Defaulted)
+		pb.F_Fixed64Defaulted = Uint64(Default_GoTest_F_Fixed64Defaulted)
+		pb.F_Uint32Defaulted = Uint32(Default_GoTest_F_Uint32Defaulted)
+		pb.F_Uint64Defaulted = Uint64(Default_GoTest_F_Uint64Defaulted)
+		pb.F_FloatDefaulted = Float32(Default_GoTest_F_FloatDefaulted)
+		pb.F_DoubleDefaulted = Float64(Default_GoTest_F_DoubleDefaulted)
+		pb.F_StringDefaulted = String(Default_GoTest_F_StringDefaulted)
+		pb.F_BytesDefaulted = Default_GoTest_F_BytesDefaulted
+		pb.F_Sint32Defaulted = Int32(Default_GoTest_F_Sint32Defaulted)
+		pb.F_Sint64Defaulted = Int64(Default_GoTest_F_Sint64Defaulted)
+	}
+
+	pb.Kind = GoTest_TIME.Enum()
+	pb.RequiredField = initGoTestField()
+	pb.F_BoolRequired = Bool(true)
+	pb.F_Int32Required = Int32(3)
+	pb.F_Int64Required = Int64(6)
+	pb.F_Fixed32Required = Uint32(32)
+	pb.F_Fixed64Required = Uint64(64)
+	pb.F_Uint32Required = Uint32(3232)
+	pb.F_Uint64Required = Uint64(6464)
+	pb.F_FloatRequired = Float32(3232)
+	pb.F_DoubleRequired = Float64(6464)
+	pb.F_StringRequired = String("string")
+	pb.F_BytesRequired = []byte("bytes")
+	pb.F_Sint32Required = Int32(-32)
+	pb.F_Sint64Required = Int64(-64)
+	pb.Requiredgroup = initGoTest_RequiredGroup()
+
+	return pb
+}
+
+func fail(msg string, b *bytes.Buffer, s string, t *testing.T) {
+	data := b.Bytes()
+	ld := len(data)
+	ls := len(s) / 2
+
+	fmt.Printf("fail %s ld=%d ls=%d\n", msg, ld, ls)
+
+	// find the interesting spot - n
+	n := ls
+	if ld < ls {
+		n = ld
+	}
+	j := 0
+	for i := 0; i < n; i++ {
+		bs := hex(s[j])*16 + hex(s[j+1])
+		j += 2
+		if data[i] == bs {
+			continue
+		}
+		n = i
+		break
+	}
+	l := n - 10
+	if l < 0 {
+		l = 0
+	}
+	h := n + 10
+
+	// find the interesting spot - n
+	fmt.Printf("is[%d]:", l)
+	for i := l; i < h; i++ {
+		if i >= ld {
+			fmt.Printf(" --")
+			continue
+		}
+		fmt.Printf(" %.2x", data[i])
+	}
+	fmt.Printf("\n")
+
+	fmt.Printf("sb[%d]:", l)
+	for i := l; i < h; i++ {
+		if i >= ls {
+			fmt.Printf(" --")
+			continue
+		}
+		bs := hex(s[j])*16 + hex(s[j+1])
+		j += 2
+		fmt.Printf(" %.2x", bs)
+	}
+	fmt.Printf("\n")
+
+	t.Fail()
+
+	//	t.Errorf("%s: \ngood: %s\nbad: %x", msg, s, b.Bytes())
+	// Print the output in a partially-decoded format; can
+	// be helpful when updating the test.  It produces the output
+	// that is pasted, with minor edits, into the argument to verify().
+	//	data := b.Bytes()
+	//	nesting := 0
+	//	for b.Len() > 0 {
+	//		start := len(data) - b.Len()
+	//		var u uint64
+	//		u, err := DecodeVarint(b)
+	//		if err != nil {
+	//			fmt.Printf("decode error on varint:", err)
+	//			return
+	//		}
+	//		wire := u & 0x7
+	//		tag := u >> 3
+	//		switch wire {
+	//		case WireVarint:
+	//			v, err := DecodeVarint(b)
+	//			if err != nil {
+	//				fmt.Printf("decode error on varint:", err)
+	//				return
+	//			}
+	//			fmt.Printf("\t\t\"%x\"  // field %d, encoding %d, value %d\n",
+	//				data[start:len(data)-b.Len()], tag, wire, v)
+	//		case WireFixed32:
+	//			v, err := DecodeFixed32(b)
+	//			if err != nil {
+	//				fmt.Printf("decode error on fixed32:", err)
+	//				return
+	//			}
+	//			fmt.Printf("\t\t\"%x\"  // field %d, encoding %d, value %d\n",
+	//				data[start:len(data)-b.Len()], tag, wire, v)
+	//		case WireFixed64:
+	//			v, err := DecodeFixed64(b)
+	//			if err != nil {
+	//				fmt.Printf("decode error on fixed64:", err)
+	//				return
+	//			}
+	//			fmt.Printf("\t\t\"%x\"  // field %d, encoding %d, value %d\n",
+	//				data[start:len(data)-b.Len()], tag, wire, v)
+	//		case WireBytes:
+	//			nb, err := DecodeVarint(b)
+	//			if err != nil {
+	//				fmt.Printf("decode error on bytes:", err)
+	//				return
+	//			}
+	//			after_tag := len(data) - b.Len()
+	//			str := make([]byte, nb)
+	//			_, err = b.Read(str)
+	//			if err != nil {
+	//				fmt.Printf("decode error on bytes:", err)
+	//				return
+	//			}
+	//			fmt.Printf("\t\t\"%x\" \"%x\"  // field %d, encoding %d (FIELD)\n",
+	//				data[start:after_tag], str, tag, wire)
+	//		case WireStartGroup:
+	//			nesting++
+	//			fmt.Printf("\t\t\"%x\"\t\t// start group field %d level %d\n",
+	//				data[start:len(data)-b.Len()], tag, nesting)
+	//		case WireEndGroup:
+	//			fmt.Printf("\t\t\"%x\"\t\t// end group field %d level %d\n",
+	//				data[start:len(data)-b.Len()], tag, nesting)
+	//			nesting--
+	//		default:
+	//			fmt.Printf("unrecognized wire type %d\n", wire)
+	//			return
+	//		}
+	//	}
+}
+
+func hex(c uint8) uint8 {
+	if '0' <= c && c <= '9' {
+		return c - '0'
+	}
+	if 'a' <= c && c <= 'f' {
+		return 10 + c - 'a'
+	}
+	if 'A' <= c && c <= 'F' {
+		return 10 + c - 'A'
+	}
+	return 0
+}
+
+func equal(b []byte, s string, t *testing.T) bool {
+	if 2*len(b) != len(s) {
+		//		fail(fmt.Sprintf("wrong lengths: 2*%d != %d", len(b), len(s)), b, s, t)
+		fmt.Printf("wrong lengths: 2*%d != %d\n", len(b), len(s))
+		return false
+	}
+	for i, j := 0, 0; i < len(b); i, j = i+1, j+2 {
+		x := hex(s[j])*16 + hex(s[j+1])
+		if b[i] != x {
+			//			fail(fmt.Sprintf("bad byte[%d]:%x %x", i, b[i], x), b, s, t)
+			fmt.Printf("bad byte[%d]:%x %x", i, b[i], x)
+			return false
+		}
+	}
+	return true
+}
+
+func overify(t *testing.T, pb *GoTest, expected string) {
+	o := old()
+	err := o.Marshal(pb)
+	if err != nil {
+		fmt.Printf("overify marshal-1 err = %v", err)
+		o.DebugPrint("", o.Bytes())
+		t.Fatalf("expected = %s", expected)
+	}
+	if !equal(o.Bytes(), expected, t) {
+		o.DebugPrint("overify neq 1", o.Bytes())
+		t.Fatalf("expected = %s", expected)
+	}
+
+	// Now test Unmarshal by recreating the original buffer.
+	pbd := new(GoTest)
+	err = o.Unmarshal(pbd)
+	if err != nil {
+		t.Fatalf("overify unmarshal err = %v", err)
+		o.DebugPrint("", o.Bytes())
+		t.Fatalf("string = %s", expected)
+	}
+	o.Reset()
+	err = o.Marshal(pbd)
+	if err != nil {
+		t.Errorf("overify marshal-2 err = %v", err)
+		o.DebugPrint("", o.Bytes())
+		t.Fatalf("string = %s", expected)
+	}
+	if !equal(o.Bytes(), expected, t) {
+		o.DebugPrint("overify neq 2", o.Bytes())
+		t.Fatalf("string = %s", expected)
+	}
+}
+
+// Simple tests for numeric encode/decode primitives (varint, etc.)
+func TestNumericPrimitives(t *testing.T) {
+	for i := uint64(0); i < 1e6; i += 111 {
+		o := old()
+		if o.EncodeVarint(i) != nil {
+			t.Error("EncodeVarint")
+			break
+		}
+		x, e := o.DecodeVarint()
+		if e != nil {
+			t.Fatal("DecodeVarint")
+		}
+		if x != i {
+			t.Fatal("varint decode fail:", i, x)
+		}
+
+		o = old()
+		if o.EncodeFixed32(i) != nil {
+			t.Fatal("encFixed32")
+		}
+		x, e = o.DecodeFixed32()
+		if e != nil {
+			t.Fatal("decFixed32")
+		}
+		if x != i {
+			t.Fatal("fixed32 decode fail:", i, x)
+		}
+
+		o = old()
+		if o.EncodeFixed64(i*1234567) != nil {
+			t.Error("encFixed64")
+			break
+		}
+		x, e = o.DecodeFixed64()
+		if e != nil {
+			t.Error("decFixed64")
+			break
+		}
+		if x != i*1234567 {
+			t.Error("fixed64 decode fail:", i*1234567, x)
+			break
+		}
+
+		o = old()
+		i32 := int32(i - 12345)
+		if o.EncodeZigzag32(uint64(i32)) != nil {
+			t.Fatal("EncodeZigzag32")
+		}
+		x, e = o.DecodeZigzag32()
+		if e != nil {
+			t.Fatal("DecodeZigzag32")
+		}
+		if x != uint64(uint32(i32)) {
+			t.Fatal("zigzag32 decode fail:", i32, x)
+		}
+
+		o = old()
+		i64 := int64(i - 12345)
+		if o.EncodeZigzag64(uint64(i64)) != nil {
+			t.Fatal("EncodeZigzag64")
+		}
+		x, e = o.DecodeZigzag64()
+		if e != nil {
+			t.Fatal("DecodeZigzag64")
+		}
+		if x != uint64(i64) {
+			t.Fatal("zigzag64 decode fail:", i64, x)
+		}
+	}
+}
+
+// fakeMarshaler is a simple struct implementing Marshaler and Message interfaces.
+type fakeMarshaler struct {
+	b   []byte
+	err error
+}
+
+func (f *fakeMarshaler) Marshal() ([]byte, error) { return f.b, f.err }
+func (f *fakeMarshaler) String() string           { return fmt.Sprintf("Bytes: %v Error: %v", f.b, f.err) }
+func (f *fakeMarshaler) ProtoMessage()            {}
+func (f *fakeMarshaler) Reset()                   {}
+
+type msgWithFakeMarshaler struct {
+	M *fakeMarshaler `protobuf:"bytes,1,opt,name=fake"`
+}
+
+func (m *msgWithFakeMarshaler) String() string { return CompactTextString(m) }
+func (m *msgWithFakeMarshaler) ProtoMessage()  {}
+func (m *msgWithFakeMarshaler) Reset()         {}
+
+// Simple tests for proto messages that implement the Marshaler interface.
+func TestMarshalerEncoding(t *testing.T) {
+	tests := []struct {
+		name    string
+		m       Message
+		want    []byte
+		errType reflect.Type
+	}{
+		{
+			name: "Marshaler that fails",
+			m: &fakeMarshaler{
+				err: errors.New("some marshal err"),
+				b:   []byte{5, 6, 7},
+			},
+			// Since the Marshal method returned bytes, they should be written to the
+			// buffer.  (For efficiency, we assume that Marshal implementations are
+			// always correct w.r.t. RequiredNotSetError and output.)
+			want:    []byte{5, 6, 7},
+			errType: reflect.TypeOf(errors.New("some marshal err")),
+		},
+		{
+			name: "Marshaler that fails with RequiredNotSetError",
+			m: &msgWithFakeMarshaler{
+				M: &fakeMarshaler{
+					err: &RequiredNotSetError{},
+					b:   []byte{5, 6, 7},
+				},
+			},
+			// Since there's an error that can be continued after,
+			// the buffer should be written.
+			want: []byte{
+				10, 3, // for &msgWithFakeMarshaler
+				5, 6, 7, // for &fakeMarshaler
+			},
+			errType: reflect.TypeOf(&RequiredNotSetError{}),
+		},
+		{
+			name: "Marshaler that succeeds",
+			m: &fakeMarshaler{
+				b: []byte{0, 1, 2, 3, 4, 127, 255},
+			},
+			want: []byte{0, 1, 2, 3, 4, 127, 255},
+		},
+	}
+	for _, test := range tests {
+		b := NewBuffer(nil)
+		err := b.Marshal(test.m)
+		if reflect.TypeOf(err) != test.errType {
+			t.Errorf("%s: got err %T(%v) wanted %T", test.name, err, err, test.errType)
+		}
+		if !reflect.DeepEqual(test.want, b.Bytes()) {
+			t.Errorf("%s: got bytes %v wanted %v", test.name, b.Bytes(), test.want)
+		}
+		if size := Size(test.m); size != len(b.Bytes()) {
+			t.Errorf("%s: Size(_) = %v, but marshaled to %v bytes", test.name, size, len(b.Bytes()))
+		}
+
+		m, mErr := Marshal(test.m)
+		if !bytes.Equal(b.Bytes(), m) {
+			t.Errorf("%s: Marshal returned %v, but (*Buffer).Marshal wrote %v", test.name, m, b.Bytes())
+		}
+		if !reflect.DeepEqual(err, mErr) {
+			t.Errorf("%s: Marshal err = %q, but (*Buffer).Marshal returned %q",
+				test.name, fmt.Sprint(mErr), fmt.Sprint(err))
+		}
+	}
+}
+
+// Simple tests for bytes
+func TestBytesPrimitives(t *testing.T) {
+	o := old()
+	bytes := []byte{'n', 'o', 'w', ' ', 'i', 's', ' ', 't', 'h', 'e', ' ', 't', 'i', 'm', 'e'}
+	if o.EncodeRawBytes(bytes) != nil {
+		t.Error("EncodeRawBytes")
+	}
+	decb, e := o.DecodeRawBytes(false)
+	if e != nil {
+		t.Error("DecodeRawBytes")
+	}
+	equalbytes(bytes, decb, t)
+}
+
+// Simple tests for strings
+func TestStringPrimitives(t *testing.T) {
+	o := old()
+	s := "now is the time"
+	if o.EncodeStringBytes(s) != nil {
+		t.Error("enc_string")
+	}
+	decs, e := o.DecodeStringBytes()
+	if e != nil {
+		t.Error("dec_string")
+	}
+	if s != decs {
+		t.Error("string encode/decode fail:", s, decs)
+	}
+}
+
+// Do we catch the "required bit not set" case?
+func TestRequiredBit(t *testing.T) {
+	o := old()
+	pb := new(GoTest)
+	err := o.Marshal(pb)
+	if err == nil {
+		t.Error("did not catch missing required fields")
+	} else if strings.Index(err.Error(), "Kind") < 0 {
+		t.Error("wrong error type:", err)
+	}
+}
+
+// Check that all fields are nil.
+// Clearly silly, and a residue from a more interesting test with an earlier,
+// different initialization property, but it once caught a compiler bug so
+// it lives.
+func checkInitialized(pb *GoTest, t *testing.T) {
+	if pb.F_BoolDefaulted != nil {
+		t.Error("New or Reset did not set boolean:", *pb.F_BoolDefaulted)
+	}
+	if pb.F_Int32Defaulted != nil {
+		t.Error("New or Reset did not set int32:", *pb.F_Int32Defaulted)
+	}
+	if pb.F_Int64Defaulted != nil {
+		t.Error("New or Reset did not set int64:", *pb.F_Int64Defaulted)
+	}
+	if pb.F_Fixed32Defaulted != nil {
+		t.Error("New or Reset did not set fixed32:", *pb.F_Fixed32Defaulted)
+	}
+	if pb.F_Fixed64Defaulted != nil {
+		t.Error("New or Reset did not set fixed64:", *pb.F_Fixed64Defaulted)
+	}
+	if pb.F_Uint32Defaulted != nil {
+		t.Error("New or Reset did not set uint32:", *pb.F_Uint32Defaulted)
+	}
+	if pb.F_Uint64Defaulted != nil {
+		t.Error("New or Reset did not set uint64:", *pb.F_Uint64Defaulted)
+	}
+	if pb.F_FloatDefaulted != nil {
+		t.Error("New or Reset did not set float:", *pb.F_FloatDefaulted)
+	}
+	if pb.F_DoubleDefaulted != nil {
+		t.Error("New or Reset did not set double:", *pb.F_DoubleDefaulted)
+	}
+	if pb.F_StringDefaulted != nil {
+		t.Error("New or Reset did not set string:", *pb.F_StringDefaulted)
+	}
+	if pb.F_BytesDefaulted != nil {
+		t.Error("New or Reset did not set bytes:", string(pb.F_BytesDefaulted))
+	}
+	if pb.F_Sint32Defaulted != nil {
+		t.Error("New or Reset did not set int32:", *pb.F_Sint32Defaulted)
+	}
+	if pb.F_Sint64Defaulted != nil {
+		t.Error("New or Reset did not set int64:", *pb.F_Sint64Defaulted)
+	}
+}
+
+// Does Reset() reset?
+func TestReset(t *testing.T) {
+	pb := initGoTest(true)
+	// muck with some values
+	pb.F_BoolDefaulted = Bool(false)
+	pb.F_Int32Defaulted = Int32(237)
+	pb.F_Int64Defaulted = Int64(12346)
+	pb.F_Fixed32Defaulted = Uint32(32000)
+	pb.F_Fixed64Defaulted = Uint64(666)
+	pb.F_Uint32Defaulted = Uint32(323232)
+	pb.F_Uint64Defaulted = nil
+	pb.F_FloatDefaulted = nil
+	pb.F_DoubleDefaulted = Float64(0)
+	pb.F_StringDefaulted = String("gotcha")
+	pb.F_BytesDefaulted = []byte("asdfasdf")
+	pb.F_Sint32Defaulted = Int32(123)
+	pb.F_Sint64Defaulted = Int64(789)
+	pb.Reset()
+	checkInitialized(pb, t)
+}
+
+// All required fields set, no defaults provided.
+func TestEncodeDecode1(t *testing.T) {
+	pb := initGoTest(false)
+	overify(t, pb,
+		"0807"+ // field 1, encoding 0, value 7
+			"220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
+			"5001"+ // field 10, encoding 0, value 1
+			"5803"+ // field 11, encoding 0, value 3
+			"6006"+ // field 12, encoding 0, value 6
+			"6d20000000"+ // field 13, encoding 5, value 0x20
+			"714000000000000000"+ // field 14, encoding 1, value 0x40
+			"78a019"+ // field 15, encoding 0, value 0xca0 = 3232
+			"8001c032"+ // field 16, encoding 0, value 0x1940 = 6464
+			"8d0100004a45"+ // field 17, encoding 5, value 3232.0
+			"9101000000000040b940"+ // field 18, encoding 1, value 6464.0
+			"9a0106"+"737472696e67"+ // field 19, encoding 2, string "string"
+			"b304"+ // field 70, encoding 3, start group
+			"ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
+			"b404"+ // field 70, encoding 4, end group
+			"aa0605"+"6279746573"+ // field 101, encoding 2, string "bytes"
+			"b0063f"+ // field 102, encoding 0, 0x3f zigzag32
+			"b8067f") // field 103, encoding 0, 0x7f zigzag64
+}
+
+// All required fields set, defaults provided.
+func TestEncodeDecode2(t *testing.T) {
+	pb := initGoTest(true)
+	overify(t, pb,
+		"0807"+ // field 1, encoding 0, value 7
+			"220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
+			"5001"+ // field 10, encoding 0, value 1
+			"5803"+ // field 11, encoding 0, value 3
+			"6006"+ // field 12, encoding 0, value 6
+			"6d20000000"+ // field 13, encoding 5, value 32
+			"714000000000000000"+ // field 14, encoding 1, value 64
+			"78a019"+ // field 15, encoding 0, value 3232
+			"8001c032"+ // field 16, encoding 0, value 6464
+			"8d0100004a45"+ // field 17, encoding 5, value 3232.0
+			"9101000000000040b940"+ // field 18, encoding 1, value 6464.0
+			"9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
+			"c00201"+ // field 40, encoding 0, value 1
+			"c80220"+ // field 41, encoding 0, value 32
+			"d00240"+ // field 42, encoding 0, value 64
+			"dd0240010000"+ // field 43, encoding 5, value 320
+			"e1028002000000000000"+ // field 44, encoding 1, value 640
+			"e8028019"+ // field 45, encoding 0, value 3200
+			"f0028032"+ // field 46, encoding 0, value 6400
+			"fd02e0659948"+ // field 47, encoding 5, value 314159.0
+			"81030000000050971041"+ // field 48, encoding 1, value 271828.0
+			"8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
+			"b304"+ // start group field 70 level 1
+			"ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
+			"b404"+ // end group field 70 level 1
+			"aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
+			"b0063f"+ // field 102, encoding 0, 0x3f zigzag32
+			"b8067f"+ // field 103, encoding 0, 0x7f zigzag64
+			"8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
+			"90193f"+ // field 402, encoding 0, value 63
+			"98197f") // field 403, encoding 0, value 127
+
+}
+
+// All default fields set to their default value by hand
+func TestEncodeDecode3(t *testing.T) {
+	pb := initGoTest(false)
+	pb.F_BoolDefaulted = Bool(true)
+	pb.F_Int32Defaulted = Int32(32)
+	pb.F_Int64Defaulted = Int64(64)
+	pb.F_Fixed32Defaulted = Uint32(320)
+	pb.F_Fixed64Defaulted = Uint64(640)
+	pb.F_Uint32Defaulted = Uint32(3200)
+	pb.F_Uint64Defaulted = Uint64(6400)
+	pb.F_FloatDefaulted = Float32(314159)
+	pb.F_DoubleDefaulted = Float64(271828)
+	pb.F_StringDefaulted = String("hello, \"world!\"\n")
+	pb.F_BytesDefaulted = []byte("Bignose")
+	pb.F_Sint32Defaulted = Int32(-32)
+	pb.F_Sint64Defaulted = Int64(-64)
+
+	overify(t, pb,
+		"0807"+ // field 1, encoding 0, value 7
+			"220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
+			"5001"+ // field 10, encoding 0, value 1
+			"5803"+ // field 11, encoding 0, value 3
+			"6006"+ // field 12, encoding 0, value 6
+			"6d20000000"+ // field 13, encoding 5, value 32
+			"714000000000000000"+ // field 14, encoding 1, value 64
+			"78a019"+ // field 15, encoding 0, value 3232
+			"8001c032"+ // field 16, encoding 0, value 6464
+			"8d0100004a45"+ // field 17, encoding 5, value 3232.0
+			"9101000000000040b940"+ // field 18, encoding 1, value 6464.0
+			"9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
+			"c00201"+ // field 40, encoding 0, value 1
+			"c80220"+ // field 41, encoding 0, value 32
+			"d00240"+ // field 42, encoding 0, value 64
+			"dd0240010000"+ // field 43, encoding 5, value 320
+			"e1028002000000000000"+ // field 44, encoding 1, value 640
+			"e8028019"+ // field 45, encoding 0, value 3200
+			"f0028032"+ // field 46, encoding 0, value 6400
+			"fd02e0659948"+ // field 47, encoding 5, value 314159.0
+			"81030000000050971041"+ // field 48, encoding 1, value 271828.0
+			"8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
+			"b304"+ // start group field 70 level 1
+			"ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
+			"b404"+ // end group field 70 level 1
+			"aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
+			"b0063f"+ // field 102, encoding 0, 0x3f zigzag32
+			"b8067f"+ // field 103, encoding 0, 0x7f zigzag64
+			"8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
+			"90193f"+ // field 402, encoding 0, value 63
+			"98197f") // field 403, encoding 0, value 127
+
+}
+
+// All required fields set, defaults provided, all non-defaulted optional fields have values.
+func TestEncodeDecode4(t *testing.T) {
+	pb := initGoTest(true)
+	pb.Table = String("hello")
+	pb.Param = Int32(7)
+	pb.OptionalField = initGoTestField()
+	pb.F_BoolOptional = Bool(true)
+	pb.F_Int32Optional = Int32(32)
+	pb.F_Int64Optional = Int64(64)
+	pb.F_Fixed32Optional = Uint32(3232)
+	pb.F_Fixed64Optional = Uint64(6464)
+	pb.F_Uint32Optional = Uint32(323232)
+	pb.F_Uint64Optional = Uint64(646464)
+	pb.F_FloatOptional = Float32(32.)
+	pb.F_DoubleOptional = Float64(64.)
+	pb.F_StringOptional = String("hello")
+	pb.F_BytesOptional = []byte("Bignose")
+	pb.F_Sint32Optional = Int32(-32)
+	pb.F_Sint64Optional = Int64(-64)
+	pb.Optionalgroup = initGoTest_OptionalGroup()
+
+	overify(t, pb,
+		"0807"+ // field 1, encoding 0, value 7
+			"1205"+"68656c6c6f"+ // field 2, encoding 2, string "hello"
+			"1807"+ // field 3, encoding 0, value 7
+			"220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
+			"320d"+"0a056c6162656c120474797065"+ // field 6, encoding 2 (GoTestField)
+			"5001"+ // field 10, encoding 0, value 1
+			"5803"+ // field 11, encoding 0, value 3
+			"6006"+ // field 12, encoding 0, value 6
+			"6d20000000"+ // field 13, encoding 5, value 32
+			"714000000000000000"+ // field 14, encoding 1, value 64
+			"78a019"+ // field 15, encoding 0, value 3232
+			"8001c032"+ // field 16, encoding 0, value 6464
+			"8d0100004a45"+ // field 17, encoding 5, value 3232.0
+			"9101000000000040b940"+ // field 18, encoding 1, value 6464.0
+			"9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
+			"f00101"+ // field 30, encoding 0, value 1
+			"f80120"+ // field 31, encoding 0, value 32
+			"800240"+ // field 32, encoding 0, value 64
+			"8d02a00c0000"+ // field 33, encoding 5, value 3232
+			"91024019000000000000"+ // field 34, encoding 1, value 6464
+			"9802a0dd13"+ // field 35, encoding 0, value 323232
+			"a002c0ba27"+ // field 36, encoding 0, value 646464
+			"ad0200000042"+ // field 37, encoding 5, value 32.0
+			"b1020000000000005040"+ // field 38, encoding 1, value 64.0
+			"ba0205"+"68656c6c6f"+ // field 39, encoding 2, string "hello"
+			"c00201"+ // field 40, encoding 0, value 1
+			"c80220"+ // field 41, encoding 0, value 32
+			"d00240"+ // field 42, encoding 0, value 64
+			"dd0240010000"+ // field 43, encoding 5, value 320
+			"e1028002000000000000"+ // field 44, encoding 1, value 640
+			"e8028019"+ // field 45, encoding 0, value 3200
+			"f0028032"+ // field 46, encoding 0, value 6400
+			"fd02e0659948"+ // field 47, encoding 5, value 314159.0
+			"81030000000050971041"+ // field 48, encoding 1, value 271828.0
+			"8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
+			"b304"+ // start group field 70 level 1
+			"ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
+			"b404"+ // end group field 70 level 1
+			"d305"+ // start group field 90 level 1
+			"da0508"+"6f7074696f6e616c"+ // field 91, encoding 2, string "optional"
+			"d405"+ // end group field 90 level 1
+			"aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
+			"b0063f"+ // field 102, encoding 0, 0x3f zigzag32
+			"b8067f"+ // field 103, encoding 0, 0x7f zigzag64
+			"ea1207"+"4269676e6f7365"+ // field 301, encoding 2, string "Bignose"
+			"f0123f"+ // field 302, encoding 0, value 63
+			"f8127f"+ // field 303, encoding 0, value 127
+			"8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
+			"90193f"+ // field 402, encoding 0, value 63
+			"98197f") // field 403, encoding 0, value 127
+
+}
+
+// All required fields set, defaults provided, all repeated fields given two values.
+func TestEncodeDecode5(t *testing.T) {
+	pb := initGoTest(true)
+	pb.RepeatedField = []*GoTestField{initGoTestField(), initGoTestField()}
+	pb.F_BoolRepeated = []bool{false, true}
+	pb.F_Int32Repeated = []int32{32, 33}
+	pb.F_Int64Repeated = []int64{64, 65}
+	pb.F_Fixed32Repeated = []uint32{3232, 3333}
+	pb.F_Fixed64Repeated = []uint64{6464, 6565}
+	pb.F_Uint32Repeated = []uint32{323232, 333333}
+	pb.F_Uint64Repeated = []uint64{646464, 656565}
+	pb.F_FloatRepeated = []float32{32., 33.}
+	pb.F_DoubleRepeated = []float64{64., 65.}
+	pb.F_StringRepeated = []string{"hello", "sailor"}
+	pb.F_BytesRepeated = [][]byte{[]byte("big"), []byte("nose")}
+	pb.F_Sint32Repeated = []int32{32, -32}
+	pb.F_Sint64Repeated = []int64{64, -64}
+	pb.Repeatedgroup = []*GoTest_RepeatedGroup{initGoTest_RepeatedGroup(), initGoTest_RepeatedGroup()}
+
+	overify(t, pb,
+		"0807"+ // field 1, encoding 0, value 7
+			"220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
+			"2a0d"+"0a056c6162656c120474797065"+ // field 5, encoding 2 (GoTestField)
+			"2a0d"+"0a056c6162656c120474797065"+ // field 5, encoding 2 (GoTestField)
+			"5001"+ // field 10, encoding 0, value 1
+			"5803"+ // field 11, encoding 0, value 3
+			"6006"+ // field 12, encoding 0, value 6
+			"6d20000000"+ // field 13, encoding 5, value 32
+			"714000000000000000"+ // field 14, encoding 1, value 64
+			"78a019"+ // field 15, encoding 0, value 3232
+			"8001c032"+ // field 16, encoding 0, value 6464
+			"8d0100004a45"+ // field 17, encoding 5, value 3232.0
+			"9101000000000040b940"+ // field 18, encoding 1, value 6464.0
+			"9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
+			"a00100"+ // field 20, encoding 0, value 0
+			"a00101"+ // field 20, encoding 0, value 1
+			"a80120"+ // field 21, encoding 0, value 32
+			"a80121"+ // field 21, encoding 0, value 33
+			"b00140"+ // field 22, encoding 0, value 64
+			"b00141"+ // field 22, encoding 0, value 65
+			"bd01a00c0000"+ // field 23, encoding 5, value 3232
+			"bd01050d0000"+ // field 23, encoding 5, value 3333
+			"c1014019000000000000"+ // field 24, encoding 1, value 6464
+			"c101a519000000000000"+ // field 24, encoding 1, value 6565
+			"c801a0dd13"+ // field 25, encoding 0, value 323232
+			"c80195ac14"+ // field 25, encoding 0, value 333333
+			"d001c0ba27"+ // field 26, encoding 0, value 646464
+			"d001b58928"+ // field 26, encoding 0, value 656565
+			"dd0100000042"+ // field 27, encoding 5, value 32.0
+			"dd0100000442"+ // field 27, encoding 5, value 33.0
+			"e1010000000000005040"+ // field 28, encoding 1, value 64.0
+			"e1010000000000405040"+ // field 28, encoding 1, value 65.0
+			"ea0105"+"68656c6c6f"+ // field 29, encoding 2, string "hello"
+			"ea0106"+"7361696c6f72"+ // field 29, encoding 2, string "sailor"
+			"c00201"+ // field 40, encoding 0, value 1
+			"c80220"+ // field 41, encoding 0, value 32
+			"d00240"+ // field 42, encoding 0, value 64
+			"dd0240010000"+ // field 43, encoding 5, value 320
+			"e1028002000000000000"+ // field 44, encoding 1, value 640
+			"e8028019"+ // field 45, encoding 0, value 3200
+			"f0028032"+ // field 46, encoding 0, value 6400
+			"fd02e0659948"+ // field 47, encoding 5, value 314159.0
+			"81030000000050971041"+ // field 48, encoding 1, value 271828.0
+			"8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
+			"b304"+ // start group field 70 level 1
+			"ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
+			"b404"+ // end group field 70 level 1
+			"8305"+ // start group field 80 level 1
+			"8a0508"+"7265706561746564"+ // field 81, encoding 2, string "repeated"
+			"8405"+ // end group field 80 level 1
+			"8305"+ // start group field 80 level 1
+			"8a0508"+"7265706561746564"+ // field 81, encoding 2, string "repeated"
+			"8405"+ // end group field 80 level 1
+			"aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
+			"b0063f"+ // field 102, encoding 0, 0x3f zigzag32
+			"b8067f"+ // field 103, encoding 0, 0x7f zigzag64
+			"ca0c03"+"626967"+ // field 201, encoding 2, string "big"
+			"ca0c04"+"6e6f7365"+ // field 201, encoding 2, string "nose"
+			"d00c40"+ // field 202, encoding 0, value 32
+			"d00c3f"+ // field 202, encoding 0, value -32
+			"d80c8001"+ // field 203, encoding 0, value 64
+			"d80c7f"+ // field 203, encoding 0, value -64
+			"8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
+			"90193f"+ // field 402, encoding 0, value 63
+			"98197f") // field 403, encoding 0, value 127
+
+}
+
+// All required fields set, all packed repeated fields given two values.
+func TestEncodeDecode6(t *testing.T) {
+	pb := initGoTest(false)
+	pb.F_BoolRepeatedPacked = []bool{false, true}
+	pb.F_Int32RepeatedPacked = []int32{32, 33}
+	pb.F_Int64RepeatedPacked = []int64{64, 65}
+	pb.F_Fixed32RepeatedPacked = []uint32{3232, 3333}
+	pb.F_Fixed64RepeatedPacked = []uint64{6464, 6565}
+	pb.F_Uint32RepeatedPacked = []uint32{323232, 333333}
+	pb.F_Uint64RepeatedPacked = []uint64{646464, 656565}
+	pb.F_FloatRepeatedPacked = []float32{32., 33.}
+	pb.F_DoubleRepeatedPacked = []float64{64., 65.}
+	pb.F_Sint32RepeatedPacked = []int32{32, -32}
+	pb.F_Sint64RepeatedPacked = []int64{64, -64}
+
+	overify(t, pb,
+		"0807"+ // field 1, encoding 0, value 7
+			"220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
+			"5001"+ // field 10, encoding 0, value 1
+			"5803"+ // field 11, encoding 0, value 3
+			"6006"+ // field 12, encoding 0, value 6
+			"6d20000000"+ // field 13, encoding 5, value 32
+			"714000000000000000"+ // field 14, encoding 1, value 64
+			"78a019"+ // field 15, encoding 0, value 3232
+			"8001c032"+ // field 16, encoding 0, value 6464
+			"8d0100004a45"+ // field 17, encoding 5, value 3232.0
+			"9101000000000040b940"+ // field 18, encoding 1, value 6464.0
+			"9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
+			"9203020001"+ // field 50, encoding 2, 2 bytes, value 0, value 1
+			"9a03022021"+ // field 51, encoding 2, 2 bytes, value 32, value 33
+			"a203024041"+ // field 52, encoding 2, 2 bytes, value 64, value 65
+			"aa0308"+ // field 53, encoding 2, 8 bytes
+			"a00c0000050d0000"+ // value 3232, value 3333
+			"b20310"+ // field 54, encoding 2, 16 bytes
+			"4019000000000000a519000000000000"+ // value 6464, value 6565
+			"ba0306"+ // field 55, encoding 2, 6 bytes
+			"a0dd1395ac14"+ // value 323232, value 333333
+			"c20306"+ // field 56, encoding 2, 6 bytes
+			"c0ba27b58928"+ // value 646464, value 656565
+			"ca0308"+ // field 57, encoding 2, 8 bytes
+			"0000004200000442"+ // value 32.0, value 33.0
+			"d20310"+ // field 58, encoding 2, 16 bytes
+			"00000000000050400000000000405040"+ // value 64.0, value 65.0
+			"b304"+ // start group field 70 level 1
+			"ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
+			"b404"+ // end group field 70 level 1
+			"aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
+			"b0063f"+ // field 102, encoding 0, 0x3f zigzag32
+			"b8067f"+ // field 103, encoding 0, 0x7f zigzag64
+			"b21f02"+ // field 502, encoding 2, 2 bytes
+			"403f"+ // value 32, value -32
+			"ba1f03"+ // field 503, encoding 2, 3 bytes
+			"80017f") // value 64, value -64
+}
+
+// Test that we can encode empty bytes fields.
+func TestEncodeDecodeBytes1(t *testing.T) {
+	pb := initGoTest(false)
+
+	// Create our bytes
+	pb.F_BytesRequired = []byte{}
+	pb.F_BytesRepeated = [][]byte{{}}
+	pb.F_BytesOptional = []byte{}
+
+	d, err := Marshal(pb)
+	if err != nil {
+		t.Error(err)
+	}
+
+	pbd := new(GoTest)
+	if err := Unmarshal(d, pbd); err != nil {
+		t.Error(err)
+	}
+
+	if pbd.F_BytesRequired == nil || len(pbd.F_BytesRequired) != 0 {
+		t.Error("required empty bytes field is incorrect")
+	}
+	if pbd.F_BytesRepeated == nil || len(pbd.F_BytesRepeated) == 1 && pbd.F_BytesRepeated[0] == nil {
+		t.Error("repeated empty bytes field is incorrect")
+	}
+	if pbd.F_BytesOptional == nil || len(pbd.F_BytesOptional) != 0 {
+		t.Error("optional empty bytes field is incorrect")
+	}
+}
+
+// Test that we encode nil-valued fields of a repeated bytes field correctly.
+// Since entries in a repeated field cannot be nil, nil must mean empty value.
+func TestEncodeDecodeBytes2(t *testing.T) {
+	pb := initGoTest(false)
+
+	// Create our bytes
+	pb.F_BytesRepeated = [][]byte{nil}
+
+	d, err := Marshal(pb)
+	if err != nil {
+		t.Error(err)
+	}
+
+	pbd := new(GoTest)
+	if err := Unmarshal(d, pbd); err != nil {
+		t.Error(err)
+	}
+
+	if len(pbd.F_BytesRepeated) != 1 || pbd.F_BytesRepeated[0] == nil {
+		t.Error("Unexpected value for repeated bytes field")
+	}
+}
+
+// All required fields set, defaults provided, all repeated fields given two values.
+func TestSkippingUnrecognizedFields(t *testing.T) {
+	o := old()
+	pb := initGoTestField()
+
+	// Marshal it normally.
+	o.Marshal(pb)
+
+	// Now new a GoSkipTest record.
+	skip := &GoSkipTest{
+		SkipInt32:   Int32(32),
+		SkipFixed32: Uint32(3232),
+		SkipFixed64: Uint64(6464),
+		SkipString:  String("skipper"),
+		Skipgroup: &GoSkipTest_SkipGroup{
+			GroupInt32:  Int32(75),
+			GroupString: String("wxyz"),
+		},
+	}
+
+	// Marshal it into same buffer.
+	o.Marshal(skip)
+
+	pbd := new(GoTestField)
+	o.Unmarshal(pbd)
+
+	// The __unrecognized field should be a marshaling of GoSkipTest
+	skipd := new(GoSkipTest)
+
+	o.SetBuf(pbd.XXX_unrecognized)
+	o.Unmarshal(skipd)
+
+	if *skipd.SkipInt32 != *skip.SkipInt32 {
+		t.Error("skip int32", skipd.SkipInt32)
+	}
+	if *skipd.SkipFixed32 != *skip.SkipFixed32 {
+		t.Error("skip fixed32", skipd.SkipFixed32)
+	}
+	if *skipd.SkipFixed64 != *skip.SkipFixed64 {
+		t.Error("skip fixed64", skipd.SkipFixed64)
+	}
+	if *skipd.SkipString != *skip.SkipString {
+		t.Error("skip string", *skipd.SkipString)
+	}
+	if *skipd.Skipgroup.GroupInt32 != *skip.Skipgroup.GroupInt32 {
+		t.Error("skip group int32", skipd.Skipgroup.GroupInt32)
+	}
+	if *skipd.Skipgroup.GroupString != *skip.Skipgroup.GroupString {
+		t.Error("skip group string", *skipd.Skipgroup.GroupString)
+	}
+}
+
+// Check that unrecognized fields of a submessage are preserved.
+func TestSubmessageUnrecognizedFields(t *testing.T) {
+	nm := &NewMessage{
+		Nested: &NewMessage_Nested{
+			Name:      String("Nigel"),
+			FoodGroup: String("carbs"),
+		},
+	}
+	b, err := Marshal(nm)
+	if err != nil {
+		t.Fatalf("Marshal of NewMessage: %v", err)
+	}
+
+	// Unmarshal into an OldMessage.
+	om := new(OldMessage)
+	if err = Unmarshal(b, om); err != nil {
+		t.Fatalf("Unmarshal to OldMessage: %v", err)
+	}
+	exp := &OldMessage{
+		Nested: &OldMessage_Nested{
+			Name: String("Nigel"),
+			// normal protocol buffer users should not do this
+			XXX_unrecognized: []byte("\x12\x05carbs"),
+		},
+	}
+	if !Equal(om, exp) {
+		t.Errorf("om = %v, want %v", om, exp)
+	}
+
+	// Clone the OldMessage.
+	om = Clone(om).(*OldMessage)
+	if !Equal(om, exp) {
+		t.Errorf("Clone(om) = %v, want %v", om, exp)
+	}
+
+	// Marshal the OldMessage, then unmarshal it into an empty NewMessage.
+	if b, err = Marshal(om); err != nil {
+		t.Fatalf("Marshal of OldMessage: %v", err)
+	}
+	t.Logf("Marshal(%v) -> %q", om, b)
+	nm2 := new(NewMessage)
+	if err := Unmarshal(b, nm2); err != nil {
+		t.Fatalf("Unmarshal to NewMessage: %v", err)
+	}
+	if !Equal(nm, nm2) {
+		t.Errorf("NewMessage round-trip: %v => %v", nm, nm2)
+	}
+}
+
+// Check that an int32 field can be upgraded to an int64 field.
+func TestNegativeInt32(t *testing.T) {
+	om := &OldMessage{
+		Num: Int32(-1),
+	}
+	b, err := Marshal(om)
+	if err != nil {
+		t.Fatalf("Marshal of OldMessage: %v", err)
+	}
+
+	// Check the size. It should be 11 bytes;
+	// 1 for the field/wire type, and 10 for the negative number.
+	if len(b) != 11 {
+		t.Errorf("%v marshaled as %q, wanted 11 bytes", om, b)
+	}
+
+	// Unmarshal into a NewMessage.
+	nm := new(NewMessage)
+	if err := Unmarshal(b, nm); err != nil {
+		t.Fatalf("Unmarshal to NewMessage: %v", err)
+	}
+	want := &NewMessage{
+		Num: Int64(-1),
+	}
+	if !Equal(nm, want) {
+		t.Errorf("nm = %v, want %v", nm, want)
+	}
+}
+
+// Check that we can grow an array (repeated field) to have many elements.
+// This test doesn't depend only on our encoding; for variety, it makes sure
+// we create, encode, and decode the correct contents explicitly.  It's therefore
+// a bit messier.
+// This test also uses (and hence tests) the Marshal/Unmarshal functions
+// instead of the methods.
+func TestBigRepeated(t *testing.T) {
+	pb := initGoTest(true)
+
+	// Create the arrays
+	const N = 50 // Internally the library starts much smaller.
+	pb.Repeatedgroup = make([]*GoTest_RepeatedGroup, N)
+	pb.F_Sint64Repeated = make([]int64, N)
+	pb.F_Sint32Repeated = make([]int32, N)
+	pb.F_BytesRepeated = make([][]byte, N)
+	pb.F_StringRepeated = make([]string, N)
+	pb.F_DoubleRepeated = make([]float64, N)
+	pb.F_FloatRepeated = make([]float32, N)
+	pb.F_Uint64Repeated = make([]uint64, N)
+	pb.F_Uint32Repeated = make([]uint32, N)
+	pb.F_Fixed64Repeated = make([]uint64, N)
+	pb.F_Fixed32Repeated = make([]uint32, N)
+	pb.F_Int64Repeated = make([]int64, N)
+	pb.F_Int32Repeated = make([]int32, N)
+	pb.F_BoolRepeated = make([]bool, N)
+	pb.RepeatedField = make([]*GoTestField, N)
+
+	// Fill in the arrays with checkable values.
+	igtf := initGoTestField()
+	igtrg := initGoTest_RepeatedGroup()
+	for i := 0; i < N; i++ {
+		pb.Repeatedgroup[i] = igtrg
+		pb.F_Sint64Repeated[i] = int64(i)
+		pb.F_Sint32Repeated[i] = int32(i)
+		s := fmt.Sprint(i)
+		pb.F_BytesRepeated[i] = []byte(s)
+		pb.F_StringRepeated[i] = s
+		pb.F_DoubleRepeated[i] = float64(i)
+		pb.F_FloatRepeated[i] = float32(i)
+		pb.F_Uint64Repeated[i] = uint64(i)
+		pb.F_Uint32Repeated[i] = uint32(i)
+		pb.F_Fixed64Repeated[i] = uint64(i)
+		pb.F_Fixed32Repeated[i] = uint32(i)
+		pb.F_Int64Repeated[i] = int64(i)
+		pb.F_Int32Repeated[i] = int32(i)
+		pb.F_BoolRepeated[i] = i%2 == 0
+		pb.RepeatedField[i] = igtf
+	}
+
+	// Marshal.
+	buf, _ := Marshal(pb)
+
+	// Now test Unmarshal by recreating the original buffer.
+	pbd := new(GoTest)
+	Unmarshal(buf, pbd)
+
+	// Check the checkable values
+	for i := uint64(0); i < N; i++ {
+		if pbd.Repeatedgroup[i] == nil { // TODO: more checking?
+			t.Error("pbd.Repeatedgroup bad")
+		}
+		var x uint64
+		x = uint64(pbd.F_Sint64Repeated[i])
+		if x != i {
+			t.Error("pbd.F_Sint64Repeated bad", x, i)
+		}
+		x = uint64(pbd.F_Sint32Repeated[i])
+		if x != i {
+			t.Error("pbd.F_Sint32Repeated bad", x, i)
+		}
+		s := fmt.Sprint(i)
+		equalbytes(pbd.F_BytesRepeated[i], []byte(s), t)
+		if pbd.F_StringRepeated[i] != s {
+			t.Error("pbd.F_Sint32Repeated bad", pbd.F_StringRepeated[i], i)
+		}
+		x = uint64(pbd.F_DoubleRepeated[i])
+		if x != i {
+			t.Error("pbd.F_DoubleRepeated bad", x, i)
+		}
+		x = uint64(pbd.F_FloatRepeated[i])
+		if x != i {
+			t.Error("pbd.F_FloatRepeated bad", x, i)
+		}
+		x = pbd.F_Uint64Repeated[i]
+		if x != i {
+			t.Error("pbd.F_Uint64Repeated bad", x, i)
+		}
+		x = uint64(pbd.F_Uint32Repeated[i])
+		if x != i {
+			t.Error("pbd.F_Uint32Repeated bad", x, i)
+		}
+		x = pbd.F_Fixed64Repeated[i]
+		if x != i {
+			t.Error("pbd.F_Fixed64Repeated bad", x, i)
+		}
+		x = uint64(pbd.F_Fixed32Repeated[i])
+		if x != i {
+			t.Error("pbd.F_Fixed32Repeated bad", x, i)
+		}
+		x = uint64(pbd.F_Int64Repeated[i])
+		if x != i {
+			t.Error("pbd.F_Int64Repeated bad", x, i)
+		}
+		x = uint64(pbd.F_Int32Repeated[i])
+		if x != i {
+			t.Error("pbd.F_Int32Repeated bad", x, i)
+		}
+		if pbd.F_BoolRepeated[i] != (i%2 == 0) {
+			t.Error("pbd.F_BoolRepeated bad", x, i)
+		}
+		if pbd.RepeatedField[i] == nil { // TODO: more checking?
+			t.Error("pbd.RepeatedField bad")
+		}
+	}
+}
+
+// Verify we give a useful message when decoding to the wrong structure type.
+func TestTypeMismatch(t *testing.T) {
+	pb1 := initGoTest(true)
+
+	// Marshal
+	o := old()
+	o.Marshal(pb1)
+
+	// Now Unmarshal it to the wrong type.
+	pb2 := initGoTestField()
+	err := o.Unmarshal(pb2)
+	if err == nil {
+		t.Error("expected error, got no error")
+	} else if !strings.Contains(err.Error(), "bad wiretype") {
+		t.Error("expected bad wiretype error, got", err)
+	}
+}
+
+func encodeDecode(t *testing.T, in, out Message, msg string) {
+	buf, err := Marshal(in)
+	if err != nil {
+		t.Fatalf("failed marshaling %v: %v", msg, err)
+	}
+	if err := Unmarshal(buf, out); err != nil {
+		t.Fatalf("failed unmarshaling %v: %v", msg, err)
+	}
+}
+
+func TestPackedNonPackedDecoderSwitching(t *testing.T) {
+	np, p := new(NonPackedTest), new(PackedTest)
+
+	// non-packed -> packed
+	np.A = []int32{0, 1, 1, 2, 3, 5}
+	encodeDecode(t, np, p, "non-packed -> packed")
+	if !reflect.DeepEqual(np.A, p.B) {
+		t.Errorf("failed non-packed -> packed; np.A=%+v, p.B=%+v", np.A, p.B)
+	}
+
+	// packed -> non-packed
+	np.Reset()
+	p.B = []int32{3, 1, 4, 1, 5, 9}
+	encodeDecode(t, p, np, "packed -> non-packed")
+	if !reflect.DeepEqual(p.B, np.A) {
+		t.Errorf("failed packed -> non-packed; p.B=%+v, np.A=%+v", p.B, np.A)
+	}
+}
+
+func TestProto1RepeatedGroup(t *testing.T) {
+	pb := &MessageList{
+		Message: []*MessageList_Message{
+			{
+				Name:  String("blah"),
+				Count: Int32(7),
+			},
+			// NOTE: pb.Message[1] is a nil
+			nil,
+		},
+	}
+
+	o := old()
+	err := o.Marshal(pb)
+	if err == nil || !strings.Contains(err.Error(), "repeated field Message has nil") {
+		t.Fatalf("unexpected or no error when marshaling: %v", err)
+	}
+}
+
+// Test that enums work.  Checks for a bug introduced by making enums
+// named types instead of int32: newInt32FromUint64 would crash with
+// a type mismatch in reflect.PointTo.
+func TestEnum(t *testing.T) {
+	pb := new(GoEnum)
+	pb.Foo = FOO_FOO1.Enum()
+	o := old()
+	if err := o.Marshal(pb); err != nil {
+		t.Fatal("error encoding enum:", err)
+	}
+	pb1 := new(GoEnum)
+	if err := o.Unmarshal(pb1); err != nil {
+		t.Fatal("error decoding enum:", err)
+	}
+	if *pb1.Foo != FOO_FOO1 {
+		t.Error("expected 7 but got ", *pb1.Foo)
+	}
+}
+
+// Enum types have String methods. Check that enum fields can be printed.
+// We don't care what the value actually is, just as long as it doesn't crash.
+func TestPrintingNilEnumFields(t *testing.T) {
+	pb := new(GoEnum)
+	_ = fmt.Sprintf("%+v", pb)
+}
+
+// Verify that absent required fields cause Marshal/Unmarshal to return errors.
+func TestRequiredFieldEnforcement(t *testing.T) {
+	pb := new(GoTestField)
+	_, err := Marshal(pb)
+	if err == nil {
+		t.Error("marshal: expected error, got nil")
+	} else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "Label") {
+		t.Errorf("marshal: bad error type: %v", err)
+	}
+
+	// A slightly sneaky, yet valid, proto. It encodes the same required field twice,
+	// so simply counting the required fields is insufficient.
+	// field 1, encoding 2, value "hi"
+	buf := []byte("\x0A\x02hi\x0A\x02hi")
+	err = Unmarshal(buf, pb)
+	if err == nil {
+		t.Error("unmarshal: expected error, got nil")
+	} else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "{Unknown}") {
+		t.Errorf("unmarshal: bad error type: %v", err)
+	}
+}
+
+// Verify that absent required fields in groups cause Marshal/Unmarshal to return errors.
+func TestRequiredFieldEnforcementGroups(t *testing.T) {
+	pb := &GoTestRequiredGroupField{Group: &GoTestRequiredGroupField_Group{}}
+	if _, err := Marshal(pb); err == nil {
+		t.Error("marshal: expected error, got nil")
+	} else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "Group.Field") {
+		t.Errorf("marshal: bad error type: %v", err)
+	}
+
+	buf := []byte{11, 12}
+	if err := Unmarshal(buf, pb); err == nil {
+		t.Error("unmarshal: expected error, got nil")
+	} else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), "Group.{Unknown}") {
+		t.Errorf("unmarshal: bad error type: %v", err)
+	}
+}
+
+func TestTypedNilMarshal(t *testing.T) {
+	// A typed nil should return ErrNil and not crash.
+	{
+		var m *GoEnum
+		if _, err := Marshal(m); err != ErrNil {
+			t.Errorf("Marshal(%#v): got %v, want ErrNil", m, err)
+		}
+	}
+
+	{
+		m := &Communique{Union: &Communique_Msg{Msg: nil}}
+		if _, err := Marshal(m); err == nil || err == ErrNil {
+			t.Errorf("Marshal(%#v): got %v, want errOneofHasNil", m, err)
+		}
+	}
+}
+
+// A type that implements the Marshaler interface, but is not nillable.
+type nonNillableInt uint64
+
+func (nni nonNillableInt) Marshal() ([]byte, error) {
+	return EncodeVarint(uint64(nni)), nil
+}
+
+type NNIMessage struct {
+	nni nonNillableInt
+}
+
+func (*NNIMessage) Reset()         {}
+func (*NNIMessage) String() string { return "" }
+func (*NNIMessage) ProtoMessage()  {}
+
+// A type that implements the Marshaler interface and is nillable.
+type nillableMessage struct {
+	x uint64
+}
+
+func (nm *nillableMessage) Marshal() ([]byte, error) {
+	return EncodeVarint(nm.x), nil
+}
+
+type NMMessage struct {
+	nm *nillableMessage
+}
+
+func (*NMMessage) Reset()         {}
+func (*NMMessage) String() string { return "" }
+func (*NMMessage) ProtoMessage()  {}
+
+// Verify a type that uses the Marshaler interface, but has a nil pointer.
+func TestNilMarshaler(t *testing.T) {
+	// Try a struct with a Marshaler field that is nil.
+	// It should be directly marshable.
+	nmm := new(NMMessage)
+	if _, err := Marshal(nmm); err != nil {
+		t.Error("unexpected error marshaling nmm: ", err)
+	}
+
+	// Try a struct with a Marshaler field that is not nillable.
+	nnim := new(NNIMessage)
+	nnim.nni = 7
+	var _ Marshaler = nnim.nni // verify it is truly a Marshaler
+	if _, err := Marshal(nnim); err != nil {
+		t.Error("unexpected error marshaling nnim: ", err)
+	}
+}
+
+func TestAllSetDefaults(t *testing.T) {
+	// Exercise SetDefaults with all scalar field types.
+	m := &Defaults{
+		// NaN != NaN, so override that here.
+		F_Nan: Float32(1.7),
+	}
+	expected := &Defaults{
+		F_Bool:    Bool(true),
+		F_Int32:   Int32(32),
+		F_Int64:   Int64(64),
+		F_Fixed32: Uint32(320),
+		F_Fixed64: Uint64(640),
+		F_Uint32:  Uint32(3200),
+		F_Uint64:  Uint64(6400),
+		F_Float:   Float32(314159),
+		F_Double:  Float64(271828),
+		F_String:  String(`hello, "world!"` + "\n"),
+		F_Bytes:   []byte("Bignose"),
+		F_Sint32:  Int32(-32),
+		F_Sint64:  Int64(-64),
+		F_Enum:    Defaults_GREEN.Enum(),
+		F_Pinf:    Float32(float32(math.Inf(1))),
+		F_Ninf:    Float32(float32(math.Inf(-1))),
+		F_Nan:     Float32(1.7),
+		StrZero:   String(""),
+	}
+	SetDefaults(m)
+	if !Equal(m, expected) {
+		t.Errorf("SetDefaults failed\n got %v\nwant %v", m, expected)
+	}
+}
+
+func TestSetDefaultsWithSetField(t *testing.T) {
+	// Check that a set value is not overridden.
+	m := &Defaults{
+		F_Int32: Int32(12),
+	}
+	SetDefaults(m)
+	if v := m.GetF_Int32(); v != 12 {
+		t.Errorf("m.FInt32 = %v, want 12", v)
+	}
+}
+
+func TestSetDefaultsWithSubMessage(t *testing.T) {
+	m := &OtherMessage{
+		Key: Int64(123),
+		Inner: &InnerMessage{
+			Host: String("gopher"),
+		},
+	}
+	expected := &OtherMessage{
+		Key: Int64(123),
+		Inner: &InnerMessage{
+			Host: String("gopher"),
+			Port: Int32(4000),
+		},
+	}
+	SetDefaults(m)
+	if !Equal(m, expected) {
+		t.Errorf("\n got %v\nwant %v", m, expected)
+	}
+}
+
+func TestSetDefaultsWithRepeatedSubMessage(t *testing.T) {
+	m := &MyMessage{
+		RepInner: []*InnerMessage{{}},
+	}
+	expected := &MyMessage{
+		RepInner: []*InnerMessage{{
+			Port: Int32(4000),
+		}},
+	}
+	SetDefaults(m)
+	if !Equal(m, expected) {
+		t.Errorf("\n got %v\nwant %v", m, expected)
+	}
+}
+
+func TestSetDefaultWithRepeatedNonMessage(t *testing.T) {
+	m := &MyMessage{
+		Pet: []string{"turtle", "wombat"},
+	}
+	expected := Clone(m)
+	SetDefaults(m)
+	if !Equal(m, expected) {
+		t.Errorf("\n got %v\nwant %v", m, expected)
+	}
+}
+
+func TestMaximumTagNumber(t *testing.T) {
+	m := &MaxTag{
+		LastField: String("natural goat essence"),
+	}
+	buf, err := Marshal(m)
+	if err != nil {
+		t.Fatalf("proto.Marshal failed: %v", err)
+	}
+	m2 := new(MaxTag)
+	if err := Unmarshal(buf, m2); err != nil {
+		t.Fatalf("proto.Unmarshal failed: %v", err)
+	}
+	if got, want := m2.GetLastField(), *m.LastField; got != want {
+		t.Errorf("got %q, want %q", got, want)
+	}
+}
+
+func TestJSON(t *testing.T) {
+	m := &MyMessage{
+		Count: Int32(4),
+		Pet:   []string{"bunny", "kitty"},
+		Inner: &InnerMessage{
+			Host: String("cauchy"),
+		},
+		Bikeshed: MyMessage_GREEN.Enum(),
+	}
+	const expected = `{"count":4,"pet":["bunny","kitty"],"inner":{"host":"cauchy"},"bikeshed":1}`
+
+	b, err := json.Marshal(m)
+	if err != nil {
+		t.Fatalf("json.Marshal failed: %v", err)
+	}
+	s := string(b)
+	if s != expected {
+		t.Errorf("got  %s\nwant %s", s, expected)
+	}
+
+	received := new(MyMessage)
+	if err := json.Unmarshal(b, received); err != nil {
+		t.Fatalf("json.Unmarshal failed: %v", err)
+	}
+	if !Equal(received, m) {
+		t.Fatalf("got %s, want %s", received, m)
+	}
+
+	// Test unmarshalling of JSON with symbolic enum name.
+	const old = `{"count":4,"pet":["bunny","kitty"],"inner":{"host":"cauchy"},"bikeshed":"GREEN"}`
+	received.Reset()
+	if err := json.Unmarshal([]byte(old), received); err != nil {
+		t.Fatalf("json.Unmarshal failed: %v", err)
+	}
+	if !Equal(received, m) {
+		t.Fatalf("got %s, want %s", received, m)
+	}
+}
+
+func TestBadWireType(t *testing.T) {
+	b := []byte{7<<3 | 6} // field 7, wire type 6
+	pb := new(OtherMessage)
+	if err := Unmarshal(b, pb); err == nil {
+		t.Errorf("Unmarshal did not fail")
+	} else if !strings.Contains(err.Error(), "unknown wire type") {
+		t.Errorf("wrong error: %v", err)
+	}
+}
+
+func TestBytesWithInvalidLength(t *testing.T) {
+	// If a byte sequence has an invalid (negative) length, Unmarshal should not panic.
+	b := []byte{2<<3 | WireBytes, 0xff, 0xff, 0xff, 0xff, 0xff, 0}
+	Unmarshal(b, new(MyMessage))
+}
+
+func TestLengthOverflow(t *testing.T) {
+	// Overflowing a length should not panic.
+	b := []byte{2<<3 | WireBytes, 1, 1, 3<<3 | WireBytes, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x01}
+	Unmarshal(b, new(MyMessage))
+}
+
+func TestVarintOverflow(t *testing.T) {
+	// Overflowing a 64-bit length should not be allowed.
+	b := []byte{1<<3 | WireVarint, 0x01, 3<<3 | WireBytes, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01}
+	if err := Unmarshal(b, new(MyMessage)); err == nil {
+		t.Fatalf("Overflowed uint64 length without error")
+	}
+}
+
+func TestUnmarshalFuzz(t *testing.T) {
+	const N = 1000
+	seed := time.Now().UnixNano()
+	t.Logf("RNG seed is %d", seed)
+	rng := rand.New(rand.NewSource(seed))
+	buf := make([]byte, 20)
+	for i := 0; i < N; i++ {
+		for j := range buf {
+			buf[j] = byte(rng.Intn(256))
+		}
+		fuzzUnmarshal(t, buf)
+	}
+}
+
+func TestMergeMessages(t *testing.T) {
+	pb := &MessageList{Message: []*MessageList_Message{{Name: String("x"), Count: Int32(1)}}}
+	data, err := Marshal(pb)
+	if err != nil {
+		t.Fatalf("Marshal: %v", err)
+	}
+
+	pb1 := new(MessageList)
+	if err := Unmarshal(data, pb1); err != nil {
+		t.Fatalf("first Unmarshal: %v", err)
+	}
+	if err := Unmarshal(data, pb1); err != nil {
+		t.Fatalf("second Unmarshal: %v", err)
+	}
+	if len(pb1.Message) != 1 {
+		t.Errorf("two Unmarshals produced %d Messages, want 1", len(pb1.Message))
+	}
+
+	pb2 := new(MessageList)
+	if err := UnmarshalMerge(data, pb2); err != nil {
+		t.Fatalf("first UnmarshalMerge: %v", err)
+	}
+	if err := UnmarshalMerge(data, pb2); err != nil {
+		t.Fatalf("second UnmarshalMerge: %v", err)
+	}
+	if len(pb2.Message) != 2 {
+		t.Errorf("two UnmarshalMerges produced %d Messages, want 2", len(pb2.Message))
+	}
+}
+
+func TestExtensionMarshalOrder(t *testing.T) {
+	m := &MyMessage{Count: Int(123)}
+	if err := SetExtension(m, E_Ext_More, &Ext{Data: String("alpha")}); err != nil {
+		t.Fatalf("SetExtension: %v", err)
+	}
+	if err := SetExtension(m, E_Ext_Text, String("aleph")); err != nil {
+		t.Fatalf("SetExtension: %v", err)
+	}
+	if err := SetExtension(m, E_Ext_Number, Int32(1)); err != nil {
+		t.Fatalf("SetExtension: %v", err)
+	}
+
+	// Serialize m several times, and check we get the same bytes each time.
+	var orig []byte
+	for i := 0; i < 100; i++ {
+		b, err := Marshal(m)
+		if err != nil {
+			t.Fatalf("Marshal: %v", err)
+		}
+		if i == 0 {
+			orig = b
+			continue
+		}
+		if !bytes.Equal(b, orig) {
+			t.Errorf("Bytes differ on attempt #%d", i)
+		}
+	}
+}
+
+// Many extensions, because small maps might not iterate differently on each iteration.
+var exts = []*ExtensionDesc{
+	E_X201,
+	E_X202,
+	E_X203,
+	E_X204,
+	E_X205,
+	E_X206,
+	E_X207,
+	E_X208,
+	E_X209,
+	E_X210,
+	E_X211,
+	E_X212,
+	E_X213,
+	E_X214,
+	E_X215,
+	E_X216,
+	E_X217,
+	E_X218,
+	E_X219,
+	E_X220,
+	E_X221,
+	E_X222,
+	E_X223,
+	E_X224,
+	E_X225,
+	E_X226,
+	E_X227,
+	E_X228,
+	E_X229,
+	E_X230,
+	E_X231,
+	E_X232,
+	E_X233,
+	E_X234,
+	E_X235,
+	E_X236,
+	E_X237,
+	E_X238,
+	E_X239,
+	E_X240,
+	E_X241,
+	E_X242,
+	E_X243,
+	E_X244,
+	E_X245,
+	E_X246,
+	E_X247,
+	E_X248,
+	E_X249,
+	E_X250,
+}
+
+func TestMessageSetMarshalOrder(t *testing.T) {
+	m := &MyMessageSet{}
+	for _, x := range exts {
+		if err := SetExtension(m, x, &Empty{}); err != nil {
+			t.Fatalf("SetExtension: %v", err)
+		}
+	}
+
+	buf, err := Marshal(m)
+	if err != nil {
+		t.Fatalf("Marshal: %v", err)
+	}
+
+	// Serialize m several times, and check we get the same bytes each time.
+	for i := 0; i < 10; i++ {
+		b1, err := Marshal(m)
+		if err != nil {
+			t.Fatalf("Marshal: %v", err)
+		}
+		if !bytes.Equal(b1, buf) {
+			t.Errorf("Bytes differ on re-Marshal #%d", i)
+		}
+
+		m2 := &MyMessageSet{}
+		if err = Unmarshal(buf, m2); err != nil {
+			t.Errorf("Unmarshal: %v", err)
+		}
+		b2, err := Marshal(m2)
+		if err != nil {
+			t.Errorf("re-Marshal: %v", err)
+		}
+		if !bytes.Equal(b2, buf) {
+			t.Errorf("Bytes differ on round-trip #%d", i)
+		}
+	}
+}
+
+func TestUnmarshalMergesMessages(t *testing.T) {
+	// If a nested message occurs twice in the input,
+	// the fields should be merged when decoding.
+	a := &OtherMessage{
+		Key: Int64(123),
+		Inner: &InnerMessage{
+			Host: String("polhode"),
+			Port: Int32(1234),
+		},
+	}
+	aData, err := Marshal(a)
+	if err != nil {
+		t.Fatalf("Marshal(a): %v", err)
+	}
+	b := &OtherMessage{
+		Weight: Float32(1.2),
+		Inner: &InnerMessage{
+			Host:      String("herpolhode"),
+			Connected: Bool(true),
+		},
+	}
+	bData, err := Marshal(b)
+	if err != nil {
+		t.Fatalf("Marshal(b): %v", err)
+	}
+	want := &OtherMessage{
+		Key:    Int64(123),
+		Weight: Float32(1.2),
+		Inner: &InnerMessage{
+			Host:      String("herpolhode"),
+			Port:      Int32(1234),
+			Connected: Bool(true),
+		},
+	}
+	got := new(OtherMessage)
+	if err := Unmarshal(append(aData, bData...), got); err != nil {
+		t.Fatalf("Unmarshal: %v", err)
+	}
+	if !Equal(got, want) {
+		t.Errorf("\n got %v\nwant %v", got, want)
+	}
+}
+
+func TestEncodingSizes(t *testing.T) {
+	tests := []struct {
+		m Message
+		n int
+	}{
+		{&Defaults{F_Int32: Int32(math.MaxInt32)}, 6},
+		{&Defaults{F_Int32: Int32(math.MinInt32)}, 11},
+		{&Defaults{F_Uint32: Uint32(uint32(math.MaxInt32) + 1)}, 6},
+		{&Defaults{F_Uint32: Uint32(math.MaxUint32)}, 6},
+	}
+	for _, test := range tests {
+		b, err := Marshal(test.m)
+		if err != nil {
+			t.Errorf("Marshal(%v): %v", test.m, err)
+			continue
+		}
+		if len(b) != test.n {
+			t.Errorf("Marshal(%v) yielded %d bytes, want %d bytes", test.m, len(b), test.n)
+		}
+	}
+}
+
+func TestRequiredNotSetError(t *testing.T) {
+	pb := initGoTest(false)
+	pb.RequiredField.Label = nil
+	pb.F_Int32Required = nil
+	pb.F_Int64Required = nil
+
+	expected := "0807" + // field 1, encoding 0, value 7
+		"2206" + "120474797065" + // field 4, encoding 2 (GoTestField)
+		"5001" + // field 10, encoding 0, value 1
+		"6d20000000" + // field 13, encoding 5, value 0x20
+		"714000000000000000" + // field 14, encoding 1, value 0x40
+		"78a019" + // field 15, encoding 0, value 0xca0 = 3232
+		"8001c032" + // field 16, encoding 0, value 0x1940 = 6464
+		"8d0100004a45" + // field 17, encoding 5, value 3232.0
+		"9101000000000040b940" + // field 18, encoding 1, value 6464.0
+		"9a0106" + "737472696e67" + // field 19, encoding 2, string "string"
+		"b304" + // field 70, encoding 3, start group
+		"ba0408" + "7265717569726564" + // field 71, encoding 2, string "required"
+		"b404" + // field 70, encoding 4, end group
+		"aa0605" + "6279746573" + // field 101, encoding 2, string "bytes"
+		"b0063f" + // field 102, encoding 0, 0x3f zigzag32
+		"b8067f" // field 103, encoding 0, 0x7f zigzag64
+
+	o := old()
+	mbytes, err := Marshal(pb)
+	if _, ok := err.(*RequiredNotSetError); !ok {
+		fmt.Printf("marshal-1 err = %v, want *RequiredNotSetError", err)
+		o.DebugPrint("", mbytes)
+		t.Fatalf("expected = %s", expected)
+	}
+	if strings.Index(err.Error(), "RequiredField.Label") < 0 {
+		t.Errorf("marshal-1 wrong err msg: %v", err)
+	}
+	if !equal(mbytes, expected, t) {
+		o.DebugPrint("neq 1", mbytes)
+		t.Fatalf("expected = %s", expected)
+	}
+
+	// Now test Unmarshal by recreating the original buffer.
+	pbd := new(GoTest)
+	err = Unmarshal(mbytes, pbd)
+	if _, ok := err.(*RequiredNotSetError); !ok {
+		t.Fatalf("unmarshal err = %v, want *RequiredNotSetError", err)
+		o.DebugPrint("", mbytes)
+		t.Fatalf("string = %s", expected)
+	}
+	if strings.Index(err.Error(), "RequiredField.{Unknown}") < 0 {
+		t.Errorf("unmarshal wrong err msg: %v", err)
+	}
+	mbytes, err = Marshal(pbd)
+	if _, ok := err.(*RequiredNotSetError); !ok {
+		t.Errorf("marshal-2 err = %v, want *RequiredNotSetError", err)
+		o.DebugPrint("", mbytes)
+		t.Fatalf("string = %s", expected)
+	}
+	if strings.Index(err.Error(), "RequiredField.Label") < 0 {
+		t.Errorf("marshal-2 wrong err msg: %v", err)
+	}
+	if !equal(mbytes, expected, t) {
+		o.DebugPrint("neq 2", mbytes)
+		t.Fatalf("string = %s", expected)
+	}
+}
+
+func fuzzUnmarshal(t *testing.T, data []byte) {
+	defer func() {
+		if e := recover(); e != nil {
+			t.Errorf("These bytes caused a panic: %+v", data)
+			t.Logf("Stack:\n%s", debug.Stack())
+			t.FailNow()
+		}
+	}()
+
+	pb := new(MyMessage)
+	Unmarshal(data, pb)
+}
+
+func TestMapFieldMarshal(t *testing.T) {
+	m := &MessageWithMap{
+		NameMapping: map[int32]string{
+			1: "Rob",
+			4: "Ian",
+			8: "Dave",
+		},
+	}
+	b, err := Marshal(m)
+	if err != nil {
+		t.Fatalf("Marshal: %v", err)
+	}
+
+	// b should be the concatenation of these three byte sequences in some order.
+	parts := []string{
+		"\n\a\b\x01\x12\x03Rob",
+		"\n\a\b\x04\x12\x03Ian",
+		"\n\b\b\x08\x12\x04Dave",
+	}
+	ok := false
+	for i := range parts {
+		for j := range parts {
+			if j == i {
+				continue
+			}
+			for k := range parts {
+				if k == i || k == j {
+					continue
+				}
+				try := parts[i] + parts[j] + parts[k]
+				if bytes.Equal(b, []byte(try)) {
+					ok = true
+					break
+				}
+			}
+		}
+	}
+	if !ok {
+		t.Fatalf("Incorrect Marshal output.\n got %q\nwant %q (or a permutation of that)", b, parts[0]+parts[1]+parts[2])
+	}
+	t.Logf("FYI b: %q", b)
+
+	(new(Buffer)).DebugPrint("Dump of b", b)
+}
+
+func TestMapFieldRoundTrips(t *testing.T) {
+	m := &MessageWithMap{
+		NameMapping: map[int32]string{
+			1: "Rob",
+			4: "Ian",
+			8: "Dave",
+		},
+		MsgMapping: map[int64]*FloatingPoint{
+			0x7001: {F: Float64(2.0)},
+		},
+		ByteMapping: map[bool][]byte{
+			false: []byte("that's not right!"),
+			true:  []byte("aye, 'tis true!"),
+		},
+	}
+	b, err := Marshal(m)
+	if err != nil {
+		t.Fatalf("Marshal: %v", err)
+	}
+	t.Logf("FYI b: %q", b)
+	m2 := new(MessageWithMap)
+	if err := Unmarshal(b, m2); err != nil {
+		t.Fatalf("Unmarshal: %v", err)
+	}
+	for _, pair := range [][2]interface{}{
+		{m.NameMapping, m2.NameMapping},
+		{m.MsgMapping, m2.MsgMapping},
+		{m.ByteMapping, m2.ByteMapping},
+	} {
+		if !reflect.DeepEqual(pair[0], pair[1]) {
+			t.Errorf("Map did not survive a round trip.\ninitial: %v\n  final: %v", pair[0], pair[1])
+		}
+	}
+}
+
+func TestMapFieldWithNil(t *testing.T) {
+	m1 := &MessageWithMap{
+		MsgMapping: map[int64]*FloatingPoint{
+			1: nil,
+		},
+	}
+	b, err := Marshal(m1)
+	if err != nil {
+		t.Fatalf("Marshal: %v", err)
+	}
+	m2 := new(MessageWithMap)
+	if err := Unmarshal(b, m2); err != nil {
+		t.Fatalf("Unmarshal: %v, got these bytes: %v", err, b)
+	}
+	if v, ok := m2.MsgMapping[1]; !ok {
+		t.Error("msg_mapping[1] not present")
+	} else if v != nil {
+		t.Errorf("msg_mapping[1] not nil: %v", v)
+	}
+}
+
+func TestMapFieldWithNilBytes(t *testing.T) {
+	m1 := &MessageWithMap{
+		ByteMapping: map[bool][]byte{
+			false: {},
+			true:  nil,
+		},
+	}
+	n := Size(m1)
+	b, err := Marshal(m1)
+	if err != nil {
+		t.Fatalf("Marshal: %v", err)
+	}
+	if n != len(b) {
+		t.Errorf("Size(m1) = %d; want len(Marshal(m1)) = %d", n, len(b))
+	}
+	m2 := new(MessageWithMap)
+	if err := Unmarshal(b, m2); err != nil {
+		t.Fatalf("Unmarshal: %v, got these bytes: %v", err, b)
+	}
+	if v, ok := m2.ByteMapping[false]; !ok {
+		t.Error("byte_mapping[false] not present")
+	} else if len(v) != 0 {
+		t.Errorf("byte_mapping[false] not empty: %#v", v)
+	}
+	if v, ok := m2.ByteMapping[true]; !ok {
+		t.Error("byte_mapping[true] not present")
+	} else if len(v) != 0 {
+		t.Errorf("byte_mapping[true] not empty: %#v", v)
+	}
+}
+
+func TestDecodeMapFieldMissingKey(t *testing.T) {
+	b := []byte{
+		0x0A, 0x03, // message, tag 1 (name_mapping), of length 3 bytes
+		// no key
+		0x12, 0x01, 0x6D, // string value of length 1 byte, value "m"
+	}
+	got := &MessageWithMap{}
+	err := Unmarshal(b, got)
+	if err != nil {
+		t.Fatalf("failed to marshal map with missing key: %v", err)
+	}
+	want := &MessageWithMap{NameMapping: map[int32]string{0: "m"}}
+	if !Equal(got, want) {
+		t.Errorf("Unmarshaled map with no key was not as expected. got: %v, want %v", got, want)
+	}
+}
+
+func TestDecodeMapFieldMissingValue(t *testing.T) {
+	b := []byte{
+		0x0A, 0x02, // message, tag 1 (name_mapping), of length 2 bytes
+		0x08, 0x01, // varint key, value 1
+		// no value
+	}
+	got := &MessageWithMap{}
+	err := Unmarshal(b, got)
+	if err != nil {
+		t.Fatalf("failed to marshal map with missing value: %v", err)
+	}
+	want := &MessageWithMap{NameMapping: map[int32]string{1: ""}}
+	if !Equal(got, want) {
+		t.Errorf("Unmarshaled map with no value was not as expected. got: %v, want %v", got, want)
+	}
+}
+
+func TestOneof(t *testing.T) {
+	m := &Communique{}
+	b, err := Marshal(m)
+	if err != nil {
+		t.Fatalf("Marshal of empty message with oneof: %v", err)
+	}
+	if len(b) != 0 {
+		t.Errorf("Marshal of empty message yielded too many bytes: %v", b)
+	}
+
+	m = &Communique{
+		Union: &Communique_Name{Name: "Barry"},
+	}
+
+	// Round-trip.
+	b, err = Marshal(m)
+	if err != nil {
+		t.Fatalf("Marshal of message with oneof: %v", err)
+	}
+	if len(b) != 7 { // name tag/wire (1) + name len (1) + name (5)
+		t.Errorf("Incorrect marshal of message with oneof: %v", b)
+	}
+	m.Reset()
+	if err = Unmarshal(b, m); err != nil {
+		t.Fatalf("Unmarshal of message with oneof: %v", err)
+	}
+	if x, ok := m.Union.(*Communique_Name); !ok || x.Name != "Barry" {
+		t.Errorf("After round trip, Union = %+v", m.Union)
+	}
+	if name := m.GetName(); name != "Barry" {
+		t.Errorf("After round trip, GetName = %q, want %q", name, "Barry")
+	}
+
+	// Let's try with a message in the oneof.
+	m.Union = &Communique_Msg{Msg: &Strings{StringField: String("deep deep string")}}
+	b, err = Marshal(m)
+	if err != nil {
+		t.Fatalf("Marshal of message with oneof set to message: %v", err)
+	}
+	if len(b) != 20 { // msg tag/wire (1) + msg len (1) + msg (1 + 1 + 16)
+		t.Errorf("Incorrect marshal of message with oneof set to message: %v", b)
+	}
+	m.Reset()
+	if err := Unmarshal(b, m); err != nil {
+		t.Fatalf("Unmarshal of message with oneof set to message: %v", err)
+	}
+	ss, ok := m.Union.(*Communique_Msg)
+	if !ok || ss.Msg.GetStringField() != "deep deep string" {
+		t.Errorf("After round trip with oneof set to message, Union = %+v", m.Union)
+	}
+}
+
+func TestInefficientPackedBool(t *testing.T) {
+	// https://github.com/golang/protobuf/issues/76
+	inp := []byte{
+		0x12, 0x02, // 0x12 = 2<<3|2; 2 bytes
+		// Usually a bool should take a single byte,
+		// but it is permitted to be any varint.
+		0xb9, 0x30,
+	}
+	if err := Unmarshal(inp, new(MoreRepeated)); err != nil {
+		t.Error(err)
+	}
+}
+
+// Benchmarks
+
+func testMsg() *GoTest {
+	pb := initGoTest(true)
+	const N = 1000 // Internally the library starts much smaller.
+	pb.F_Int32Repeated = make([]int32, N)
+	pb.F_DoubleRepeated = make([]float64, N)
+	for i := 0; i < N; i++ {
+		pb.F_Int32Repeated[i] = int32(i)
+		pb.F_DoubleRepeated[i] = float64(i)
+	}
+	return pb
+}
+
+func bytesMsg() *GoTest {
+	pb := initGoTest(true)
+	buf := make([]byte, 4000)
+	for i := range buf {
+		buf[i] = byte(i)
+	}
+	pb.F_BytesDefaulted = buf
+	return pb
+}
+
+func benchmarkMarshal(b *testing.B, pb Message, marshal func(Message) ([]byte, error)) {
+	d, _ := marshal(pb)
+	b.SetBytes(int64(len(d)))
+	b.ResetTimer()
+	for i := 0; i < b.N; i++ {
+		marshal(pb)
+	}
+}
+
+func benchmarkBufferMarshal(b *testing.B, pb Message) {
+	p := NewBuffer(nil)
+	benchmarkMarshal(b, pb, func(pb0 Message) ([]byte, error) {
+		p.Reset()
+		err := p.Marshal(pb0)
+		return p.Bytes(), err
+	})
+}
+
+func benchmarkSize(b *testing.B, pb Message) {
+	benchmarkMarshal(b, pb, func(pb0 Message) ([]byte, error) {
+		Size(pb)
+		return nil, nil
+	})
+}
+
+func newOf(pb Message) Message {
+	in := reflect.ValueOf(pb)
+	if in.IsNil() {
+		return pb
+	}
+	return reflect.New(in.Type().Elem()).Interface().(Message)
+}
+
+func benchmarkUnmarshal(b *testing.B, pb Message, unmarshal func([]byte, Message) error) {
+	d, _ := Marshal(pb)
+	b.SetBytes(int64(len(d)))
+	pbd := newOf(pb)
+
+	b.ResetTimer()
+	for i := 0; i < b.N; i++ {
+		unmarshal(d, pbd)
+	}
+}
+
+func benchmarkBufferUnmarshal(b *testing.B, pb Message) {
+	p := NewBuffer(nil)
+	benchmarkUnmarshal(b, pb, func(d []byte, pb0 Message) error {
+		p.SetBuf(d)
+		return p.Unmarshal(pb0)
+	})
+}
+
+// Benchmark{Marshal,BufferMarshal,Size,Unmarshal,BufferUnmarshal}{,Bytes}
+
+func BenchmarkMarshal(b *testing.B) {
+	benchmarkMarshal(b, testMsg(), Marshal)
+}
+
+func BenchmarkBufferMarshal(b *testing.B) {
+	benchmarkBufferMarshal(b, testMsg())
+}
+
+func BenchmarkSize(b *testing.B) {
+	benchmarkSize(b, testMsg())
+}
+
+func BenchmarkUnmarshal(b *testing.B) {
+	benchmarkUnmarshal(b, testMsg(), Unmarshal)
+}
+
+func BenchmarkBufferUnmarshal(b *testing.B) {
+	benchmarkBufferUnmarshal(b, testMsg())
+}
+
+func BenchmarkMarshalBytes(b *testing.B) {
+	benchmarkMarshal(b, bytesMsg(), Marshal)
+}
+
+func BenchmarkBufferMarshalBytes(b *testing.B) {
+	benchmarkBufferMarshal(b, bytesMsg())
+}
+
+func BenchmarkSizeBytes(b *testing.B) {
+	benchmarkSize(b, bytesMsg())
+}
+
+func BenchmarkUnmarshalBytes(b *testing.B) {
+	benchmarkUnmarshal(b, bytesMsg(), Unmarshal)
+}
+
+func BenchmarkBufferUnmarshalBytes(b *testing.B) {
+	benchmarkBufferUnmarshal(b, bytesMsg())
+}
+
+func BenchmarkUnmarshalUnrecognizedFields(b *testing.B) {
+	b.StopTimer()
+	pb := initGoTestField()
+	skip := &GoSkipTest{
+		SkipInt32:   Int32(32),
+		SkipFixed32: Uint32(3232),
+		SkipFixed64: Uint64(6464),
+		SkipString:  String("skipper"),
+		Skipgroup: &GoSkipTest_SkipGroup{
+			GroupInt32:  Int32(75),
+			GroupString: String("wxyz"),
+		},
+	}
+
+	pbd := new(GoTestField)
+	p := NewBuffer(nil)
+	p.Marshal(pb)
+	p.Marshal(skip)
+	p2 := NewBuffer(nil)
+
+	b.StartTimer()
+	for i := 0; i < b.N; i++ {
+		p2.SetBuf(p.Bytes())
+		p2.Unmarshal(pbd)
+	}
+}

+ 300 - 0
vendor/github.com/gogo/protobuf/proto/any_test.go

@@ -0,0 +1,300 @@
+// Go support for Protocol Buffers - Google's data interchange format
+//
+// Copyright 2016 The Go Authors.  All rights reserved.
+// https://github.com/golang/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package proto_test
+
+import (
+	"strings"
+	"testing"
+
+	"github.com/gogo/protobuf/proto"
+
+	pb "github.com/gogo/protobuf/proto/proto3_proto"
+	testpb "github.com/gogo/protobuf/proto/testdata"
+	"github.com/gogo/protobuf/types"
+)
+
+var (
+	expandedMarshaler        = proto.TextMarshaler{ExpandAny: true}
+	expandedCompactMarshaler = proto.TextMarshaler{Compact: true, ExpandAny: true}
+)
+
+// anyEqual reports whether two messages which may be google.protobuf.Any or may
+// contain google.protobuf.Any fields are equal. We can't use proto.Equal for
+// comparison, because semantically equivalent messages may be marshaled to
+// binary in different tag order. Instead, trust that TextMarshaler with
+// ExpandAny option works and compare the text marshaling results.
+func anyEqual(got, want proto.Message) bool {
+	// if messages are proto.Equal, no need to marshal.
+	if proto.Equal(got, want) {
+		return true
+	}
+	g := expandedMarshaler.Text(got)
+	w := expandedMarshaler.Text(want)
+	return g == w
+}
+
+type golden struct {
+	m    proto.Message
+	t, c string
+}
+
+var goldenMessages = makeGolden()
+
+func makeGolden() []golden {
+	nested := &pb.Nested{Bunny: "Monty"}
+	nb, err := proto.Marshal(nested)
+	if err != nil {
+		panic(err)
+	}
+	m1 := &pb.Message{
+		Name:        "David",
+		ResultCount: 47,
+		Anything:    &types.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(nested), Value: nb},
+	}
+	m2 := &pb.Message{
+		Name:        "David",
+		ResultCount: 47,
+		Anything:    &types.Any{TypeUrl: "http://[::1]/type.googleapis.com/" + proto.MessageName(nested), Value: nb},
+	}
+	m3 := &pb.Message{
+		Name:        "David",
+		ResultCount: 47,
+		Anything:    &types.Any{TypeUrl: `type.googleapis.com/"/` + proto.MessageName(nested), Value: nb},
+	}
+	m4 := &pb.Message{
+		Name:        "David",
+		ResultCount: 47,
+		Anything:    &types.Any{TypeUrl: "type.googleapis.com/a/path/" + proto.MessageName(nested), Value: nb},
+	}
+	m5 := &types.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(nested), Value: nb}
+
+	any1 := &testpb.MyMessage{Count: proto.Int32(47), Name: proto.String("David")}
+	proto.SetExtension(any1, testpb.E_Ext_More, &testpb.Ext{Data: proto.String("foo")})
+	proto.SetExtension(any1, testpb.E_Ext_Text, proto.String("bar"))
+	any1b, err := proto.Marshal(any1)
+	if err != nil {
+		panic(err)
+	}
+	any2 := &testpb.MyMessage{Count: proto.Int32(42), Bikeshed: testpb.MyMessage_GREEN.Enum(), RepBytes: [][]byte{[]byte("roboto")}}
+	proto.SetExtension(any2, testpb.E_Ext_More, &testpb.Ext{Data: proto.String("baz")})
+	any2b, err := proto.Marshal(any2)
+	if err != nil {
+		panic(err)
+	}
+	m6 := &pb.Message{
+		Name:        "David",
+		ResultCount: 47,
+		Anything:    &types.Any{TypeUrl: "type.googleapis.com/" + proto.MessageName(any1), Value: any1b},
+		ManyThings: []*types.Any{
+			{TypeUrl: "type.googleapis.com/" + proto.MessageName(any2), Value: any2b},
+			{TypeUrl: "type.googleapis.com/" + proto.MessageName(any1), Value: any1b},
+		},
+	}
+
+	const (
+		m1Golden = `
+name: "David"
+result_count: 47
+anything: <
+  [type.googleapis.com/proto3_proto.Nested]: <
+    bunny: "Monty"
+  >
+>
+`
+		m2Golden = `
+name: "David"
+result_count: 47
+anything: <
+  ["http://[::1]/type.googleapis.com/proto3_proto.Nested"]: <
+    bunny: "Monty"
+  >
+>
+`
+		m3Golden = `
+name: "David"
+result_count: 47
+anything: <
+  ["type.googleapis.com/\"/proto3_proto.Nested"]: <
+    bunny: "Monty"
+  >
+>
+`
+		m4Golden = `
+name: "David"
+result_count: 47
+anything: <
+  [type.googleapis.com/a/path/proto3_proto.Nested]: <
+    bunny: "Monty"
+  >
+>
+`
+		m5Golden = `
+[type.googleapis.com/proto3_proto.Nested]: <
+  bunny: "Monty"
+>
+`
+		m6Golden = `
+name: "David"
+result_count: 47
+anything: <
+  [type.googleapis.com/testdata.MyMessage]: <
+    count: 47
+    name: "David"
+    [testdata.Ext.more]: <
+      data: "foo"
+    >
+    [testdata.Ext.text]: "bar"
+  >
+>
+many_things: <
+  [type.googleapis.com/testdata.MyMessage]: <
+    count: 42
+    bikeshed: GREEN
+    rep_bytes: "roboto"
+    [testdata.Ext.more]: <
+      data: "baz"
+    >
+  >
+>
+many_things: <
+  [type.googleapis.com/testdata.MyMessage]: <
+    count: 47
+    name: "David"
+    [testdata.Ext.more]: <
+      data: "foo"
+    >
+    [testdata.Ext.text]: "bar"
+  >
+>
+`
+	)
+	return []golden{
+		{m1, strings.TrimSpace(m1Golden) + "\n", strings.TrimSpace(compact(m1Golden)) + " "},
+		{m2, strings.TrimSpace(m2Golden) + "\n", strings.TrimSpace(compact(m2Golden)) + " "},
+		{m3, strings.TrimSpace(m3Golden) + "\n", strings.TrimSpace(compact(m3Golden)) + " "},
+		{m4, strings.TrimSpace(m4Golden) + "\n", strings.TrimSpace(compact(m4Golden)) + " "},
+		{m5, strings.TrimSpace(m5Golden) + "\n", strings.TrimSpace(compact(m5Golden)) + " "},
+		{m6, strings.TrimSpace(m6Golden) + "\n", strings.TrimSpace(compact(m6Golden)) + " "},
+	}
+}
+
+func TestMarshalGolden(t *testing.T) {
+	for _, tt := range goldenMessages {
+		if got, want := expandedMarshaler.Text(tt.m), tt.t; got != want {
+			t.Errorf("message %v: got:\n%s\nwant:\n%s", tt.m, got, want)
+		}
+		if got, want := expandedCompactMarshaler.Text(tt.m), tt.c; got != want {
+			t.Errorf("message %v: got:\n`%s`\nwant:\n`%s`", tt.m, got, want)
+		}
+	}
+}
+
+func TestUnmarshalGolden(t *testing.T) {
+	for _, tt := range goldenMessages {
+		want := tt.m
+		got := proto.Clone(tt.m)
+		got.Reset()
+		if err := proto.UnmarshalText(tt.t, got); err != nil {
+			t.Errorf("failed to unmarshal\n%s\nerror: %v", tt.t, err)
+		}
+		if !anyEqual(got, want) {
+			t.Errorf("message:\n%s\ngot:\n%s\nwant:\n%s", tt.t, got, want)
+		}
+		got.Reset()
+		if err := proto.UnmarshalText(tt.c, got); err != nil {
+			t.Errorf("failed to unmarshal\n%s\nerror: %v", tt.c, err)
+		}
+		if !anyEqual(got, want) {
+			t.Errorf("message:\n%s\ngot:\n%s\nwant:\n%s", tt.c, got, want)
+		}
+	}
+}
+
+func TestMarshalUnknownAny(t *testing.T) {
+	m := &pb.Message{
+		Anything: &types.Any{
+			TypeUrl: "foo",
+			Value:   []byte("bar"),
+		},
+	}
+	want := `anything: <
+  type_url: "foo"
+  value: "bar"
+>
+`
+	got := expandedMarshaler.Text(m)
+	if got != want {
+		t.Errorf("got\n`%s`\nwant\n`%s`", got, want)
+	}
+}
+
+func TestAmbiguousAny(t *testing.T) {
+	pb := &types.Any{}
+	err := proto.UnmarshalText(`
+	type_url: "ttt/proto3_proto.Nested"
+	value: "\n\x05Monty"
+	`, pb)
+	t.Logf("result: %v (error: %v)", expandedMarshaler.Text(pb), err)
+	if err != nil {
+		t.Errorf("failed to parse ambiguous Any message: %v", err)
+	}
+}
+
+func TestUnmarshalOverwriteAny(t *testing.T) {
+	pb := &types.Any{}
+	err := proto.UnmarshalText(`
+  [type.googleapis.com/a/path/proto3_proto.Nested]: <
+    bunny: "Monty"
+  >
+  [type.googleapis.com/a/path/proto3_proto.Nested]: <
+    bunny: "Rabbit of Caerbannog"
+  >
+	`, pb)
+	want := `line 7: Any message unpacked multiple times, or "type_url" already set`
+	if err.Error() != want {
+		t.Errorf("incorrect error.\nHave: %v\nWant: %v", err.Error(), want)
+	}
+}
+
+func TestUnmarshalAnyMixAndMatch(t *testing.T) {
+	pb := &types.Any{}
+	err := proto.UnmarshalText(`
+	value: "\n\x05Monty"
+  [type.googleapis.com/a/path/proto3_proto.Nested]: <
+    bunny: "Rabbit of Caerbannog"
+  >
+	`, pb)
+	want := `line 5: Any message unpacked multiple times, or "value" already set`
+	if err.Error() != want {
+		t.Errorf("incorrect error.\nHave: %v\nWant: %v", err.Error(), want)
+	}
+}

+ 10 - 4
vendor/github.com/gogo/protobuf/proto/clone.go

@@ -84,14 +84,20 @@ func mergeStruct(out, in reflect.Value) {
 		mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i])
 		mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i])
 	}
 	}
 
 
-	if emIn, ok := in.Addr().Interface().(extensionsMap); ok {
-		emOut := out.Addr().Interface().(extensionsMap)
-		mergeExtension(emOut.ExtensionMap(), emIn.ExtensionMap())
-	} else if emIn, ok := in.Addr().Interface().(extensionsBytes); ok {
+	if emIn, ok := in.Addr().Interface().(extensionsBytes); ok {
 		emOut := out.Addr().Interface().(extensionsBytes)
 		emOut := out.Addr().Interface().(extensionsBytes)
 		bIn := emIn.GetExtensions()
 		bIn := emIn.GetExtensions()
 		bOut := emOut.GetExtensions()
 		bOut := emOut.GetExtensions()
 		*bOut = append(*bOut, *bIn...)
 		*bOut = append(*bOut, *bIn...)
+	} else if emIn, ok := extendable(in.Addr().Interface()); ok {
+		emOut, _ := extendable(out.Addr().Interface())
+		mIn, muIn := emIn.extensionsRead()
+		if mIn != nil {
+			mOut := emOut.extensionsWrite()
+			muIn.Lock()
+			mergeExtension(mOut, mIn)
+			muIn.Unlock()
+		}
 	}
 	}
 
 
 	uf := in.FieldByName("XXX_unrecognized")
 	uf := in.FieldByName("XXX_unrecognized")

+ 300 - 0
vendor/github.com/gogo/protobuf/proto/clone_test.go

@@ -0,0 +1,300 @@
+// Go support for Protocol Buffers - Google's data interchange format
+//
+// Copyright 2011 The Go Authors.  All rights reserved.
+// https://github.com/golang/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package proto_test
+
+import (
+	"testing"
+
+	"github.com/gogo/protobuf/proto"
+
+	proto3pb "github.com/gogo/protobuf/proto/proto3_proto"
+	pb "github.com/gogo/protobuf/proto/testdata"
+)
+
+var cloneTestMessage = &pb.MyMessage{
+	Count: proto.Int32(42),
+	Name:  proto.String("Dave"),
+	Pet:   []string{"bunny", "kitty", "horsey"},
+	Inner: &pb.InnerMessage{
+		Host:      proto.String("niles"),
+		Port:      proto.Int32(9099),
+		Connected: proto.Bool(true),
+	},
+	Others: []*pb.OtherMessage{
+		{
+			Value: []byte("some bytes"),
+		},
+	},
+	Somegroup: &pb.MyMessage_SomeGroup{
+		GroupField: proto.Int32(6),
+	},
+	RepBytes: [][]byte{[]byte("sham"), []byte("wow")},
+}
+
+func init() {
+	ext := &pb.Ext{
+		Data: proto.String("extension"),
+	}
+	if err := proto.SetExtension(cloneTestMessage, pb.E_Ext_More, ext); err != nil {
+		panic("SetExtension: " + err.Error())
+	}
+}
+
+func TestClone(t *testing.T) {
+	m := proto.Clone(cloneTestMessage).(*pb.MyMessage)
+	if !proto.Equal(m, cloneTestMessage) {
+		t.Errorf("Clone(%v) = %v", cloneTestMessage, m)
+	}
+
+	// Verify it was a deep copy.
+	*m.Inner.Port++
+	if proto.Equal(m, cloneTestMessage) {
+		t.Error("Mutating clone changed the original")
+	}
+	// Byte fields and repeated fields should be copied.
+	if &m.Pet[0] == &cloneTestMessage.Pet[0] {
+		t.Error("Pet: repeated field not copied")
+	}
+	if &m.Others[0] == &cloneTestMessage.Others[0] {
+		t.Error("Others: repeated field not copied")
+	}
+	if &m.Others[0].Value[0] == &cloneTestMessage.Others[0].Value[0] {
+		t.Error("Others[0].Value: bytes field not copied")
+	}
+	if &m.RepBytes[0] == &cloneTestMessage.RepBytes[0] {
+		t.Error("RepBytes: repeated field not copied")
+	}
+	if &m.RepBytes[0][0] == &cloneTestMessage.RepBytes[0][0] {
+		t.Error("RepBytes[0]: bytes field not copied")
+	}
+}
+
+func TestCloneNil(t *testing.T) {
+	var m *pb.MyMessage
+	if c := proto.Clone(m); !proto.Equal(m, c) {
+		t.Errorf("Clone(%v) = %v", m, c)
+	}
+}
+
+var mergeTests = []struct {
+	src, dst, want proto.Message
+}{
+	{
+		src: &pb.MyMessage{
+			Count: proto.Int32(42),
+		},
+		dst: &pb.MyMessage{
+			Name: proto.String("Dave"),
+		},
+		want: &pb.MyMessage{
+			Count: proto.Int32(42),
+			Name:  proto.String("Dave"),
+		},
+	},
+	{
+		src: &pb.MyMessage{
+			Inner: &pb.InnerMessage{
+				Host:      proto.String("hey"),
+				Connected: proto.Bool(true),
+			},
+			Pet: []string{"horsey"},
+			Others: []*pb.OtherMessage{
+				{
+					Value: []byte("some bytes"),
+				},
+			},
+		},
+		dst: &pb.MyMessage{
+			Inner: &pb.InnerMessage{
+				Host: proto.String("niles"),
+				Port: proto.Int32(9099),
+			},
+			Pet: []string{"bunny", "kitty"},
+			Others: []*pb.OtherMessage{
+				{
+					Key: proto.Int64(31415926535),
+				},
+				{
+					// Explicitly test a src=nil field
+					Inner: nil,
+				},
+			},
+		},
+		want: &pb.MyMessage{
+			Inner: &pb.InnerMessage{
+				Host:      proto.String("hey"),
+				Connected: proto.Bool(true),
+				Port:      proto.Int32(9099),
+			},
+			Pet: []string{"bunny", "kitty", "horsey"},
+			Others: []*pb.OtherMessage{
+				{
+					Key: proto.Int64(31415926535),
+				},
+				{},
+				{
+					Value: []byte("some bytes"),
+				},
+			},
+		},
+	},
+	{
+		src: &pb.MyMessage{
+			RepBytes: [][]byte{[]byte("wow")},
+		},
+		dst: &pb.MyMessage{
+			Somegroup: &pb.MyMessage_SomeGroup{
+				GroupField: proto.Int32(6),
+			},
+			RepBytes: [][]byte{[]byte("sham")},
+		},
+		want: &pb.MyMessage{
+			Somegroup: &pb.MyMessage_SomeGroup{
+				GroupField: proto.Int32(6),
+			},
+			RepBytes: [][]byte{[]byte("sham"), []byte("wow")},
+		},
+	},
+	// Check that a scalar bytes field replaces rather than appends.
+	{
+		src:  &pb.OtherMessage{Value: []byte("foo")},
+		dst:  &pb.OtherMessage{Value: []byte("bar")},
+		want: &pb.OtherMessage{Value: []byte("foo")},
+	},
+	{
+		src: &pb.MessageWithMap{
+			NameMapping: map[int32]string{6: "Nigel"},
+			MsgMapping: map[int64]*pb.FloatingPoint{
+				0x4001: {F: proto.Float64(2.0)},
+				0x4002: {
+					F: proto.Float64(2.0),
+				},
+			},
+			ByteMapping: map[bool][]byte{true: []byte("wowsa")},
+		},
+		dst: &pb.MessageWithMap{
+			NameMapping: map[int32]string{
+				6: "Bruce", // should be overwritten
+				7: "Andrew",
+			},
+			MsgMapping: map[int64]*pb.FloatingPoint{
+				0x4002: {
+					F:     proto.Float64(3.0),
+					Exact: proto.Bool(true),
+				}, // the entire message should be overwritten
+			},
+		},
+		want: &pb.MessageWithMap{
+			NameMapping: map[int32]string{
+				6: "Nigel",
+				7: "Andrew",
+			},
+			MsgMapping: map[int64]*pb.FloatingPoint{
+				0x4001: {F: proto.Float64(2.0)},
+				0x4002: {
+					F: proto.Float64(2.0),
+				},
+			},
+			ByteMapping: map[bool][]byte{true: []byte("wowsa")},
+		},
+	},
+	// proto3 shouldn't merge zero values,
+	// in the same way that proto2 shouldn't merge nils.
+	{
+		src: &proto3pb.Message{
+			Name: "Aaron",
+			Data: []byte(""), // zero value, but not nil
+		},
+		dst: &proto3pb.Message{
+			HeightInCm: 176,
+			Data:       []byte("texas!"),
+		},
+		want: &proto3pb.Message{
+			Name:       "Aaron",
+			HeightInCm: 176,
+			Data:       []byte("texas!"),
+		},
+	},
+	// Oneof fields should merge by assignment.
+	{
+		src: &pb.Communique{
+			Union: &pb.Communique_Number{Number: 41},
+		},
+		dst: &pb.Communique{
+			Union: &pb.Communique_Name{Name: "Bobby Tables"},
+		},
+		want: &pb.Communique{
+			Union: &pb.Communique_Number{Number: 41},
+		},
+	},
+	// Oneof nil is the same as not set.
+	{
+		src: &pb.Communique{},
+		dst: &pb.Communique{
+			Union: &pb.Communique_Name{Name: "Bobby Tables"},
+		},
+		want: &pb.Communique{
+			Union: &pb.Communique_Name{Name: "Bobby Tables"},
+		},
+	},
+	{
+		src: &proto3pb.Message{
+			Terrain: map[string]*proto3pb.Nested{
+				"kay_a": {Cute: true},      // replace
+				"kay_b": {Bunny: "rabbit"}, // insert
+			},
+		},
+		dst: &proto3pb.Message{
+			Terrain: map[string]*proto3pb.Nested{
+				"kay_a": {Bunny: "lost"},  // replaced
+				"kay_c": {Bunny: "bunny"}, // keep
+			},
+		},
+		want: &proto3pb.Message{
+			Terrain: map[string]*proto3pb.Nested{
+				"kay_a": {Cute: true},
+				"kay_b": {Bunny: "rabbit"},
+				"kay_c": {Bunny: "bunny"},
+			},
+		},
+	},
+}
+
+func TestMerge(t *testing.T) {
+	for _, m := range mergeTests {
+		got := proto.Clone(m.dst)
+		proto.Merge(got, m.src)
+		if !proto.Equal(got, m.want) {
+			t.Errorf("Merge(%v, %v)\n got %v\nwant %v\n", m.dst, m.src, got, m.want)
+		}
+	}
+}

+ 126 - 20
vendor/github.com/gogo/protobuf/proto/decode.go

@@ -61,7 +61,6 @@ var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for
 // int32, int64, uint32, uint64, bool, and enum
 // int32, int64, uint32, uint64, bool, and enum
 // protocol buffer types.
 // protocol buffer types.
 func DecodeVarint(buf []byte) (x uint64, n int) {
 func DecodeVarint(buf []byte) (x uint64, n int) {
-	// x, n already 0
 	for shift := uint(0); shift < 64; shift += 7 {
 	for shift := uint(0); shift < 64; shift += 7 {
 		if n >= len(buf) {
 		if n >= len(buf) {
 			return 0, 0
 			return 0, 0
@@ -78,13 +77,7 @@ func DecodeVarint(buf []byte) (x uint64, n int) {
 	return 0, 0
 	return 0, 0
 }
 }
 
 
-// DecodeVarint reads a varint-encoded integer from the Buffer.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func (p *Buffer) DecodeVarint() (x uint64, err error) {
-	// x, err already 0
-
+func (p *Buffer) decodeVarintSlow() (x uint64, err error) {
 	i := p.index
 	i := p.index
 	l := len(p.buf)
 	l := len(p.buf)
 
 
@@ -107,6 +100,107 @@ func (p *Buffer) DecodeVarint() (x uint64, err error) {
 	return
 	return
 }
 }
 
 
+// DecodeVarint reads a varint-encoded integer from the Buffer.
+// This is the format for the
+// int32, int64, uint32, uint64, bool, and enum
+// protocol buffer types.
+func (p *Buffer) DecodeVarint() (x uint64, err error) {
+	i := p.index
+	buf := p.buf
+
+	if i >= len(buf) {
+		return 0, io.ErrUnexpectedEOF
+	} else if buf[i] < 0x80 {
+		p.index++
+		return uint64(buf[i]), nil
+	} else if len(buf)-i < 10 {
+		return p.decodeVarintSlow()
+	}
+
+	var b uint64
+	// we already checked the first byte
+	x = uint64(buf[i]) - 0x80
+	i++
+
+	b = uint64(buf[i])
+	i++
+	x += b << 7
+	if b&0x80 == 0 {
+		goto done
+	}
+	x -= 0x80 << 7
+
+	b = uint64(buf[i])
+	i++
+	x += b << 14
+	if b&0x80 == 0 {
+		goto done
+	}
+	x -= 0x80 << 14
+
+	b = uint64(buf[i])
+	i++
+	x += b << 21
+	if b&0x80 == 0 {
+		goto done
+	}
+	x -= 0x80 << 21
+
+	b = uint64(buf[i])
+	i++
+	x += b << 28
+	if b&0x80 == 0 {
+		goto done
+	}
+	x -= 0x80 << 28
+
+	b = uint64(buf[i])
+	i++
+	x += b << 35
+	if b&0x80 == 0 {
+		goto done
+	}
+	x -= 0x80 << 35
+
+	b = uint64(buf[i])
+	i++
+	x += b << 42
+	if b&0x80 == 0 {
+		goto done
+	}
+	x -= 0x80 << 42
+
+	b = uint64(buf[i])
+	i++
+	x += b << 49
+	if b&0x80 == 0 {
+		goto done
+	}
+	x -= 0x80 << 49
+
+	b = uint64(buf[i])
+	i++
+	x += b << 56
+	if b&0x80 == 0 {
+		goto done
+	}
+	x -= 0x80 << 56
+
+	b = uint64(buf[i])
+	i++
+	x += b << 63
+	if b&0x80 == 0 {
+		goto done
+	}
+	// x -= 0x80 << 63 // Always zero.
+
+	return 0, errOverflow
+
+done:
+	p.index = i
+	return x, nil
+}
+
 // DecodeFixed64 reads a 64-bit integer from the Buffer.
 // DecodeFixed64 reads a 64-bit integer from the Buffer.
 // This is the format for the
 // This is the format for the
 // fixed64, sfixed64, and double protocol buffer types.
 // fixed64, sfixed64, and double protocol buffer types.
@@ -340,6 +434,8 @@ func (p *Buffer) DecodeGroup(pb Message) error {
 // Buffer and places the decoded result in pb.  If the struct
 // Buffer and places the decoded result in pb.  If the struct
 // underlying pb does not match the data in the buffer, the results can be
 // underlying pb does not match the data in the buffer, the results can be
 // unpredictable.
 // unpredictable.
+//
+// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal.
 func (p *Buffer) Unmarshal(pb Message) error {
 func (p *Buffer) Unmarshal(pb Message) error {
 	// If the object can unmarshal itself, let it.
 	// If the object can unmarshal itself, let it.
 	if u, ok := pb.(Unmarshaler); ok {
 	if u, ok := pb.(Unmarshaler); ok {
@@ -378,6 +474,11 @@ func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group
 		wire := int(u & 0x7)
 		wire := int(u & 0x7)
 		if wire == WireEndGroup {
 		if wire == WireEndGroup {
 			if is_group {
 			if is_group {
+				if required > 0 {
+					// Not enough information to determine the exact field.
+					// (See below.)
+					return &RequiredNotSetError{"{Unknown}"}
+				}
 				return nil // input is satisfied
 				return nil // input is satisfied
 			}
 			}
 			return fmt.Errorf("proto: %s: wiretype end group for non-group", st)
 			return fmt.Errorf("proto: %s: wiretype end group for non-group", st)
@@ -390,16 +491,20 @@ func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group
 		if !ok {
 		if !ok {
 			// Maybe it's an extension?
 			// Maybe it's an extension?
 			if prop.extendable {
 			if prop.extendable {
-				if e := structPointer_Interface(base, st).(extendableProto); isExtensionField(e, int32(tag)) {
-					if err = o.skip(st, tag, wire); err == nil {
-						if ee, eok := e.(extensionsMap); eok {
-							ext := ee.ExtensionMap()[int32(tag)] // may be missing
-							ext.enc = append(ext.enc, o.buf[oi:o.index]...)
-							ee.ExtensionMap()[int32(tag)] = ext
-						} else if ee, eok := e.(extensionsBytes); eok {
-							ext := ee.GetExtensions()
+				if e, eok := structPointer_Interface(base, st).(extensionsBytes); eok {
+					if isExtensionField(e, int32(tag)) {
+						if err = o.skip(st, tag, wire); err == nil {
+							ext := e.GetExtensions()
 							*ext = append(*ext, o.buf[oi:o.index]...)
 							*ext = append(*ext, o.buf[oi:o.index]...)
 						}
 						}
+						continue
+					}
+				} else if e, _ := extendable(structPointer_Interface(base, st)); isExtensionField(e, int32(tag)) {
+					if err = o.skip(st, tag, wire); err == nil {
+						extmap := e.extensionsWrite()
+						ext := extmap[int32(tag)] // may be missing
+						ext.enc = append(ext.enc, o.buf[oi:o.index]...)
+						extmap[int32(tag)] = ext
 					}
 					}
 					continue
 					continue
 				}
 				}
@@ -773,10 +878,11 @@ func (o *Buffer) dec_new_map(p *Properties, base structPointer) error {
 		}
 		}
 	}
 	}
 	keyelem, valelem := keyptr.Elem(), valptr.Elem()
 	keyelem, valelem := keyptr.Elem(), valptr.Elem()
-	if !keyelem.IsValid() || !valelem.IsValid() {
-		// We did not decode the key or the value in the map entry.
-		// Either way, it's an invalid map entry.
-		return fmt.Errorf("proto: bad map data: missing key/val")
+	if !keyelem.IsValid() {
+		keyelem = reflect.Zero(p.mtype.Key())
+	}
+	if !valelem.IsValid() {
+		valelem = reflect.Zero(p.mtype.Elem())
 	}
 	}
 
 
 	v.SetMapIndex(keyelem, valelem)
 	v.SetMapIndex(keyelem, valelem)

+ 7 - 4
vendor/github.com/gogo/protobuf/proto/decode_gogo.go

@@ -1,5 +1,7 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // modification, are permitted provided that the following conditions are
@@ -96,7 +98,7 @@ func setPtrCustomType(base structPointer, f field, v interface{}) {
 	if v == nil {
 	if v == nil {
 		return
 		return
 	}
 	}
-	structPointer_SetStructPointer(base, f, structPointer(reflect.ValueOf(v).Pointer()))
+	structPointer_SetStructPointer(base, f, toStructPointer(reflect.ValueOf(v)))
 }
 }
 
 
 func setCustomType(base structPointer, f field, value interface{}) {
 func setCustomType(base structPointer, f field, value interface{}) {
@@ -163,7 +165,8 @@ func (o *Buffer) dec_custom_slice_bytes(p *Properties, base structPointer) error
 	}
 	}
 	newBas := appendStructPointer(base, p.field, p.ctype)
 	newBas := appendStructPointer(base, p.field, p.ctype)
 
 
-	setCustomType(newBas, 0, custom)
+	var zero field
+	setCustomType(newBas, zero, custom)
 
 
 	return nil
 	return nil
 }
 }

+ 260 - 0
vendor/github.com/gogo/protobuf/proto/decode_test.go

@@ -0,0 +1,260 @@
+// Go support for Protocol Buffers - Google's data interchange format
+//
+// Copyright 2010 The Go Authors.  All rights reserved.
+// https://github.com/golang/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package proto_test
+
+import (
+	"testing"
+
+	"github.com/gogo/protobuf/proto"
+	tpb "github.com/gogo/protobuf/proto/proto3_proto"
+)
+
+var (
+	bytesBlackhole []byte
+	msgBlackhole   = new(tpb.Message)
+)
+
+// Disabled this Benchmark because it is using features (b.Run) from go1.7 and gogoprotobuf still have compatibility with go1.5
+// BenchmarkVarint32ArraySmall shows the performance on an array of small int32 fields (1 and
+// 2 bytes long).
+// func BenchmarkVarint32ArraySmall(b *testing.B) {
+// 	for i := uint(1); i <= 10; i++ {
+// 		dist := genInt32Dist([7]int{0, 3, 1}, 1<<i)
+// 		raw, err := proto.Marshal(&tpb.Message{
+// 			ShortKey: dist,
+// 		})
+// 		if err != nil {
+// 			b.Error("wrong encode", err)
+// 		}
+// 		b.Run(fmt.Sprintf("Len%v", len(dist)), func(b *testing.B) {
+// 			scratchBuf := proto.NewBuffer(nil)
+// 			b.ResetTimer()
+// 			for k := 0; k < b.N; k++ {
+// 				scratchBuf.SetBuf(raw)
+// 				msgBlackhole.Reset()
+// 				if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
+// 					b.Error("wrong decode", err)
+// 				}
+// 			}
+// 		})
+// 	}
+// }
+
+// Disabled this Benchmark because it is using features (b.Run) from go1.7 and gogoprotobuf still have compatibility with go1.5
+// BenchmarkVarint32ArrayLarge shows the performance on an array of large int32 fields (3 and
+// 4 bytes long, with a small number of 1, 2, 5 and 10 byte long versions).
+// func BenchmarkVarint32ArrayLarge(b *testing.B) {
+// 	for i := uint(1); i <= 10; i++ {
+// 		dist := genInt32Dist([7]int{0, 1, 2, 4, 8, 1, 1}, 1<<i)
+// 		raw, err := proto.Marshal(&tpb.Message{
+// 			ShortKey: dist,
+// 		})
+// 		if err != nil {
+// 			b.Error("wrong encode", err)
+// 		}
+// 		b.Run(fmt.Sprintf("Len%v", len(dist)), func(b *testing.B) {
+// 			scratchBuf := proto.NewBuffer(nil)
+// 			b.ResetTimer()
+// 			for k := 0; k < b.N; k++ {
+// 				scratchBuf.SetBuf(raw)
+// 				msgBlackhole.Reset()
+// 				if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
+// 					b.Error("wrong decode", err)
+// 				}
+// 			}
+// 		})
+// 	}
+// }
+
+// Disabled this Benchmark because it is using features (b.Run) from go1.7 and gogoprotobuf still have compatibility with go1.5
+// BenchmarkVarint64ArraySmall shows the performance on an array of small int64 fields (1 and
+// 2 bytes long).
+// func BenchmarkVarint64ArraySmall(b *testing.B) {
+// 	for i := uint(1); i <= 10; i++ {
+// 		dist := genUint64Dist([11]int{0, 3, 1}, 1<<i)
+// 		raw, err := proto.Marshal(&tpb.Message{
+// 			Key: dist,
+// 		})
+// 		if err != nil {
+// 			b.Error("wrong encode", err)
+// 		}
+// 		b.Run(fmt.Sprintf("Len%v", len(dist)), func(b *testing.B) {
+// 			scratchBuf := proto.NewBuffer(nil)
+// 			b.ResetTimer()
+// 			for k := 0; k < b.N; k++ {
+// 				scratchBuf.SetBuf(raw)
+// 				msgBlackhole.Reset()
+// 				if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
+// 					b.Error("wrong decode", err)
+// 				}
+// 			}
+// 		})
+// 	}
+// }
+
+// Disabled this Benchmark because it is using features (b.Run) from go1.7 and gogoprotobuf still have compatibility with go1.5
+// BenchmarkVarint64ArrayLarge shows the performance on an array of large int64 fields (6, 7,
+// and 8 bytes long with a small number of the other sizes).
+// func BenchmarkVarint64ArrayLarge(b *testing.B) {
+// 	for i := uint(1); i <= 10; i++ {
+// 		dist := genUint64Dist([11]int{0, 1, 1, 2, 4, 8, 16, 32, 16, 1, 1}, 1<<i)
+// 		raw, err := proto.Marshal(&tpb.Message{
+// 			Key: dist,
+// 		})
+// 		if err != nil {
+// 			b.Error("wrong encode", err)
+// 		}
+// 		b.Run(fmt.Sprintf("Len%v", len(dist)), func(b *testing.B) {
+// 			scratchBuf := proto.NewBuffer(nil)
+// 			b.ResetTimer()
+// 			for k := 0; k < b.N; k++ {
+// 				scratchBuf.SetBuf(raw)
+// 				msgBlackhole.Reset()
+// 				if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
+// 					b.Error("wrong decode", err)
+// 				}
+// 			}
+// 		})
+// 	}
+// }
+
+// Disabled this Benchmark because it is using features (b.Run) from go1.7 and gogoprotobuf still have compatibility with go1.5
+// BenchmarkVarint64ArrayMixed shows the performance of lots of small messages, each
+// containing a small number of large (3, 4, and 5 byte) repeated int64s.
+// func BenchmarkVarint64ArrayMixed(b *testing.B) {
+// 	for i := uint(1); i <= 1<<5; i <<= 1 {
+// 		dist := genUint64Dist([11]int{0, 0, 0, 4, 6, 4, 0, 0, 0, 0, 0}, int(i))
+// 		// number of sub fields
+// 		for k := uint(1); k <= 1<<10; k <<= 2 {
+// 			msg := &tpb.Message{}
+// 			for m := uint(0); m < k; m++ {
+// 				msg.Children = append(msg.Children, &tpb.Message{
+// 					Key: dist,
+// 				})
+// 			}
+// 			raw, err := proto.Marshal(msg)
+// 			if err != nil {
+// 				b.Error("wrong encode", err)
+// 			}
+// 			b.Run(fmt.Sprintf("Fields%vLen%v", k, i), func(b *testing.B) {
+// 				scratchBuf := proto.NewBuffer(nil)
+// 				b.ResetTimer()
+// 				for k := 0; k < b.N; k++ {
+// 					scratchBuf.SetBuf(raw)
+// 					msgBlackhole.Reset()
+// 					if err := scratchBuf.Unmarshal(msgBlackhole); err != nil {
+// 						b.Error("wrong decode", err)
+// 					}
+// 				}
+// 			})
+// 		}
+// 	}
+// }
+
+// genInt32Dist generates a slice of ints that will match the size distribution of dist.
+// A size of 6 corresponds to a max length varint32, which is 10 bytes.  The distribution
+// is 1-indexed. (i.e. the value at index 1 is how many 1 byte ints to create).
+func genInt32Dist(dist [7]int, count int) (dest []int32) {
+	for i := 0; i < count; i++ {
+		for k := 0; k < len(dist); k++ {
+			var num int32
+			switch k {
+			case 1:
+				num = 1<<7 - 1
+			case 2:
+				num = 1<<14 - 1
+			case 3:
+				num = 1<<21 - 1
+			case 4:
+				num = 1<<28 - 1
+			case 5:
+				num = 1<<29 - 1
+			case 6:
+				num = -1
+			}
+			for m := 0; m < dist[k]; m++ {
+				dest = append(dest, num)
+			}
+		}
+	}
+	return
+}
+
+// genUint64Dist generates a slice of ints that will match the size distribution of dist.
+// The distribution is 1-indexed. (i.e. the value at index 1 is how many 1 byte ints to create).
+func genUint64Dist(dist [11]int, count int) (dest []uint64) {
+	for i := 0; i < count; i++ {
+		for k := 0; k < len(dist); k++ {
+			var num uint64
+			switch k {
+			case 1:
+				num = 1<<7 - 1
+			case 2:
+				num = 1<<14 - 1
+			case 3:
+				num = 1<<21 - 1
+			case 4:
+				num = 1<<28 - 1
+			case 5:
+				num = 1<<35 - 1
+			case 6:
+				num = 1<<42 - 1
+			case 7:
+				num = 1<<49 - 1
+			case 8:
+				num = 1<<56 - 1
+			case 9:
+				num = 1<<63 - 1
+			case 10:
+				num = 1<<64 - 1
+			}
+			for m := 0; m < dist[k]; m++ {
+				dest = append(dest, num)
+			}
+		}
+	}
+	return
+}
+
+// BenchmarkDecodeEmpty measures the overhead of doing the minimal possible decode.
+func BenchmarkDecodeEmpty(b *testing.B) {
+	raw, err := proto.Marshal(&tpb.Message{})
+	if err != nil {
+		b.Error("wrong encode", err)
+	}
+	b.ResetTimer()
+	for i := 0; i < b.N; i++ {
+		if err := proto.Unmarshal(raw, msgBlackhole); err != nil {
+			b.Error("wrong decode", err)
+		}
+	}
+}

+ 100 - 0
vendor/github.com/gogo/protobuf/proto/duration.go

@@ -0,0 +1,100 @@
+// Go support for Protocol Buffers - Google's data interchange format
+//
+// Copyright 2016 The Go Authors.  All rights reserved.
+// https://github.com/golang/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package proto
+
+// This file implements conversions between google.protobuf.Duration
+// and time.Duration.
+
+import (
+	"errors"
+	"fmt"
+	"time"
+)
+
+const (
+	// Range of a Duration in seconds, as specified in
+	// google/protobuf/duration.proto. This is about 10,000 years in seconds.
+	maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60)
+	minSeconds = -maxSeconds
+)
+
+// validateDuration determines whether the Duration is valid according to the
+// definition in google/protobuf/duration.proto. A valid Duration
+// may still be too large to fit into a time.Duration (the range of Duration
+// is about 10,000 years, and the range of time.Duration is about 290).
+func validateDuration(d *duration) error {
+	if d == nil {
+		return errors.New("duration: nil Duration")
+	}
+	if d.Seconds < minSeconds || d.Seconds > maxSeconds {
+		return fmt.Errorf("duration: %#v: seconds out of range", d)
+	}
+	if d.Nanos <= -1e9 || d.Nanos >= 1e9 {
+		return fmt.Errorf("duration: %#v: nanos out of range", d)
+	}
+	// Seconds and Nanos must have the same sign, unless d.Nanos is zero.
+	if (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) {
+		return fmt.Errorf("duration: %#v: seconds and nanos have different signs", d)
+	}
+	return nil
+}
+
+// DurationFromProto converts a Duration to a time.Duration. DurationFromProto
+// returns an error if the Duration is invalid or is too large to be
+// represented in a time.Duration.
+func durationFromProto(p *duration) (time.Duration, error) {
+	if err := validateDuration(p); err != nil {
+		return 0, err
+	}
+	d := time.Duration(p.Seconds) * time.Second
+	if int64(d/time.Second) != p.Seconds {
+		return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p)
+	}
+	if p.Nanos != 0 {
+		d += time.Duration(p.Nanos)
+		if (d < 0) != (p.Nanos < 0) {
+			return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p)
+		}
+	}
+	return d, nil
+}
+
+// DurationProto converts a time.Duration to a Duration.
+func durationProto(d time.Duration) *duration {
+	nanos := d.Nanoseconds()
+	secs := nanos / 1e9
+	nanos -= secs * 1e9
+	return &duration{
+		Seconds: secs,
+		Nanos:   int32(nanos),
+	}
+}

+ 203 - 0
vendor/github.com/gogo/protobuf/proto/duration_gogo.go

@@ -0,0 +1,203 @@
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2016, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package proto
+
+import (
+	"reflect"
+	"time"
+)
+
+var durationType = reflect.TypeOf((*time.Duration)(nil)).Elem()
+
+type duration struct {
+	Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
+	Nanos   int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
+}
+
+func (m *duration) Reset()       { *m = duration{} }
+func (*duration) ProtoMessage()  {}
+func (*duration) String() string { return "duration<string>" }
+
+func init() {
+	RegisterType((*duration)(nil), "gogo.protobuf.proto.duration")
+}
+
+func (o *Buffer) decDuration() (time.Duration, error) {
+	b, err := o.DecodeRawBytes(true)
+	if err != nil {
+		return 0, err
+	}
+	dproto := &duration{}
+	if err := Unmarshal(b, dproto); err != nil {
+		return 0, err
+	}
+	return durationFromProto(dproto)
+}
+
+func (o *Buffer) dec_duration(p *Properties, base structPointer) error {
+	d, err := o.decDuration()
+	if err != nil {
+		return err
+	}
+	word64_Set(structPointer_Word64(base, p.field), o, uint64(d))
+	return nil
+}
+
+func (o *Buffer) dec_ref_duration(p *Properties, base structPointer) error {
+	d, err := o.decDuration()
+	if err != nil {
+		return err
+	}
+	word64Val_Set(structPointer_Word64Val(base, p.field), o, uint64(d))
+	return nil
+}
+
+func (o *Buffer) dec_slice_duration(p *Properties, base structPointer) error {
+	d, err := o.decDuration()
+	if err != nil {
+		return err
+	}
+	newBas := appendStructPointer(base, p.field, reflect.SliceOf(reflect.PtrTo(durationType)))
+	var zero field
+	setPtrCustomType(newBas, zero, &d)
+	return nil
+}
+
+func (o *Buffer) dec_slice_ref_duration(p *Properties, base structPointer) error {
+	d, err := o.decDuration()
+	if err != nil {
+		return err
+	}
+	structPointer_Word64Slice(base, p.field).Append(uint64(d))
+	return nil
+}
+
+func size_duration(p *Properties, base structPointer) (n int) {
+	structp := structPointer_GetStructPointer(base, p.field)
+	if structPointer_IsNil(structp) {
+		return 0
+	}
+	dur := structPointer_Interface(structp, durationType).(*time.Duration)
+	d := durationProto(*dur)
+	size := Size(d)
+	return size + sizeVarint(uint64(size)) + len(p.tagcode)
+}
+
+func (o *Buffer) enc_duration(p *Properties, base structPointer) error {
+	structp := structPointer_GetStructPointer(base, p.field)
+	if structPointer_IsNil(structp) {
+		return ErrNil
+	}
+	dur := structPointer_Interface(structp, durationType).(*time.Duration)
+	d := durationProto(*dur)
+	data, err := Marshal(d)
+	if err != nil {
+		return err
+	}
+	o.buf = append(o.buf, p.tagcode...)
+	o.EncodeRawBytes(data)
+	return nil
+}
+
+func size_ref_duration(p *Properties, base structPointer) (n int) {
+	dur := structPointer_InterfaceAt(base, p.field, durationType).(*time.Duration)
+	d := durationProto(*dur)
+	size := Size(d)
+	return size + sizeVarint(uint64(size)) + len(p.tagcode)
+}
+
+func (o *Buffer) enc_ref_duration(p *Properties, base structPointer) error {
+	dur := structPointer_InterfaceAt(base, p.field, durationType).(*time.Duration)
+	d := durationProto(*dur)
+	data, err := Marshal(d)
+	if err != nil {
+		return err
+	}
+	o.buf = append(o.buf, p.tagcode...)
+	o.EncodeRawBytes(data)
+	return nil
+}
+
+func size_slice_duration(p *Properties, base structPointer) (n int) {
+	pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(reflect.PtrTo(durationType))).(*[]*time.Duration)
+	durs := *pdurs
+	for i := 0; i < len(durs); i++ {
+		if durs[i] == nil {
+			return 0
+		}
+		dproto := durationProto(*durs[i])
+		size := Size(dproto)
+		n += len(p.tagcode) + size + sizeVarint(uint64(size))
+	}
+	return n
+}
+
+func (o *Buffer) enc_slice_duration(p *Properties, base structPointer) error {
+	pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(reflect.PtrTo(durationType))).(*[]*time.Duration)
+	durs := *pdurs
+	for i := 0; i < len(durs); i++ {
+		if durs[i] == nil {
+			return errRepeatedHasNil
+		}
+		dproto := durationProto(*durs[i])
+		data, err := Marshal(dproto)
+		if err != nil {
+			return err
+		}
+		o.buf = append(o.buf, p.tagcode...)
+		o.EncodeRawBytes(data)
+	}
+	return nil
+}
+
+func size_slice_ref_duration(p *Properties, base structPointer) (n int) {
+	pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(durationType)).(*[]time.Duration)
+	durs := *pdurs
+	for i := 0; i < len(durs); i++ {
+		dproto := durationProto(durs[i])
+		size := Size(dproto)
+		n += len(p.tagcode) + size + sizeVarint(uint64(size))
+	}
+	return n
+}
+
+func (o *Buffer) enc_slice_ref_duration(p *Properties, base structPointer) error {
+	pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(durationType)).(*[]time.Duration)
+	durs := *pdurs
+	for i := 0; i < len(durs); i++ {
+		dproto := durationProto(durs[i])
+		data, err := Marshal(dproto)
+		if err != nil {
+			return err
+		}
+		o.buf = append(o.buf, p.tagcode...)
+		o.EncodeRawBytes(data)
+	}
+	return nil
+}

+ 59 - 22
vendor/github.com/gogo/protobuf/proto/encode.go

@@ -64,8 +64,16 @@ var (
 	// a struct with a repeated field containing a nil element.
 	// a struct with a repeated field containing a nil element.
 	errRepeatedHasNil = errors.New("proto: repeated field has nil element")
 	errRepeatedHasNil = errors.New("proto: repeated field has nil element")
 
 
+	// errOneofHasNil is the error returned if Marshal is called with
+	// a struct with a oneof field containing a nil element.
+	errOneofHasNil = errors.New("proto: oneof field has nil value")
+
 	// ErrNil is the error returned if Marshal is called with nil.
 	// ErrNil is the error returned if Marshal is called with nil.
 	ErrNil = errors.New("proto: Marshal called with nil")
 	ErrNil = errors.New("proto: Marshal called with nil")
+
+	// ErrTooLarge is the error returned if Marshal is called with a
+	// message that encodes to >2GB.
+	ErrTooLarge = errors.New("proto: message encodes to over 2 GB")
 )
 )
 
 
 // The fundamental encoders that put bytes on the wire.
 // The fundamental encoders that put bytes on the wire.
@@ -74,6 +82,10 @@ var (
 
 
 const maxVarintBytes = 10 // maximum length of a varint
 const maxVarintBytes = 10 // maximum length of a varint
 
 
+// maxMarshalSize is the largest allowed size of an encoded protobuf,
+// since C++ and Java use signed int32s for the size.
+const maxMarshalSize = 1<<31 - 1
+
 // EncodeVarint returns the varint encoding of x.
 // EncodeVarint returns the varint encoding of x.
 // This is the format for the
 // This is the format for the
 // int32, int64, uint32, uint64, bool, and enum
 // int32, int64, uint32, uint64, bool, and enum
@@ -222,10 +234,6 @@ func Marshal(pb Message) ([]byte, error) {
 	}
 	}
 	p := NewBuffer(nil)
 	p := NewBuffer(nil)
 	err := p.Marshal(pb)
 	err := p.Marshal(pb)
-	var state errorState
-	if err != nil && !state.shouldContinue(err, nil) {
-		return nil, err
-	}
 	if p.buf == nil && err == nil {
 	if p.buf == nil && err == nil {
 		// Return a non-nil slice on success.
 		// Return a non-nil slice on success.
 		return []byte{}, nil
 		return []byte{}, nil
@@ -254,11 +262,8 @@ func (p *Buffer) Marshal(pb Message) error {
 	// Can the object marshal itself?
 	// Can the object marshal itself?
 	if m, ok := pb.(Marshaler); ok {
 	if m, ok := pb.(Marshaler); ok {
 		data, err := m.Marshal()
 		data, err := m.Marshal()
-		if err != nil {
-			return err
-		}
 		p.buf = append(p.buf, data...)
 		p.buf = append(p.buf, data...)
-		return nil
+		return err
 	}
 	}
 
 
 	t, base, err := getbase(pb)
 	t, base, err := getbase(pb)
@@ -270,9 +275,12 @@ func (p *Buffer) Marshal(pb Message) error {
 	}
 	}
 
 
 	if collectStats {
 	if collectStats {
-		stats.Encode++
+		(stats).Encode++ // Parens are to work around a goimports bug.
 	}
 	}
 
 
+	if len(p.buf) > maxMarshalSize {
+		return ErrTooLarge
+	}
 	return err
 	return err
 }
 }
 
 
@@ -294,7 +302,7 @@ func Size(pb Message) (n int) {
 	}
 	}
 
 
 	if collectStats {
 	if collectStats {
-		stats.Size++
+		(stats).Size++ // Parens are to work around a goimports bug.
 	}
 	}
 
 
 	return
 	return
@@ -999,7 +1007,6 @@ func size_slice_struct_message(p *Properties, base structPointer) (n int) {
 		if p.isMarshaler {
 		if p.isMarshaler {
 			m := structPointer_Interface(structp, p.stype).(Marshaler)
 			m := structPointer_Interface(structp, p.stype).(Marshaler)
 			data, _ := m.Marshal()
 			data, _ := m.Marshal()
-			n += len(p.tagcode)
 			n += sizeRawBytes(data)
 			n += sizeRawBytes(data)
 			continue
 			continue
 		}
 		}
@@ -1058,10 +1065,32 @@ func size_slice_struct_group(p *Properties, base structPointer) (n int) {
 
 
 // Encode an extension map.
 // Encode an extension map.
 func (o *Buffer) enc_map(p *Properties, base structPointer) error {
 func (o *Buffer) enc_map(p *Properties, base structPointer) error {
-	v := *structPointer_ExtMap(base, p.field)
-	if err := encodeExtensionMap(v); err != nil {
+	exts := structPointer_ExtMap(base, p.field)
+	if err := encodeExtensionsMap(*exts); err != nil {
+		return err
+	}
+
+	return o.enc_map_body(*exts)
+}
+
+func (o *Buffer) enc_exts(p *Properties, base structPointer) error {
+	exts := structPointer_Extensions(base, p.field)
+
+	v, mu := exts.extensionsRead()
+	if v == nil {
+		return nil
+	}
+
+	mu.Lock()
+	defer mu.Unlock()
+	if err := encodeExtensionsMap(v); err != nil {
 		return err
 		return err
 	}
 	}
+
+	return o.enc_map_body(v)
+}
+
+func (o *Buffer) enc_map_body(v map[int32]Extension) error {
 	// Fast-path for common cases: zero or one extensions.
 	// Fast-path for common cases: zero or one extensions.
 	if len(v) <= 1 {
 	if len(v) <= 1 {
 		for _, e := range v {
 		for _, e := range v {
@@ -1084,8 +1113,13 @@ func (o *Buffer) enc_map(p *Properties, base structPointer) error {
 }
 }
 
 
 func size_map(p *Properties, base structPointer) int {
 func size_map(p *Properties, base structPointer) int {
-	v := *structPointer_ExtMap(base, p.field)
-	return sizeExtensionMap(v)
+	v := structPointer_ExtMap(base, p.field)
+	return extensionsMapSize(*v)
+}
+
+func size_exts(p *Properties, base structPointer) int {
+	v := structPointer_Extensions(base, p.field)
+	return extensionsSize(v)
 }
 }
 
 
 // Encode a map field.
 // Encode a map field.
@@ -1114,7 +1148,7 @@ func (o *Buffer) enc_new_map(p *Properties, base structPointer) error {
 		if err := p.mkeyprop.enc(o, p.mkeyprop, keybase); err != nil {
 		if err := p.mkeyprop.enc(o, p.mkeyprop, keybase); err != nil {
 			return err
 			return err
 		}
 		}
-		if err := p.mvalprop.enc(o, p.mvalprop, valbase); err != nil {
+		if err := p.mvalprop.enc(o, p.mvalprop, valbase); err != nil && err != ErrNil {
 			return err
 			return err
 		}
 		}
 		return nil
 		return nil
@@ -1124,11 +1158,6 @@ func (o *Buffer) enc_new_map(p *Properties, base structPointer) error {
 	for _, key := range v.MapKeys() {
 	for _, key := range v.MapKeys() {
 		val := v.MapIndex(key)
 		val := v.MapIndex(key)
 
 
-		// The only illegal map entry values are nil message pointers.
-		if val.Kind() == reflect.Ptr && val.IsNil() {
-			return errors.New("proto: map has nil element")
-		}
-
 		keycopy.Set(key)
 		keycopy.Set(key)
 		valcopy.Set(val)
 		valcopy.Set(val)
 
 
@@ -1216,13 +1245,18 @@ func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error {
 					return err
 					return err
 				}
 				}
 			}
 			}
+			if len(o.buf) > maxMarshalSize {
+				return ErrTooLarge
+			}
 		}
 		}
 	}
 	}
 
 
 	// Do oneof fields.
 	// Do oneof fields.
 	if prop.oneofMarshaler != nil {
 	if prop.oneofMarshaler != nil {
 		m := structPointer_Interface(base, prop.stype).(Message)
 		m := structPointer_Interface(base, prop.stype).(Message)
-		if err := prop.oneofMarshaler(m, o); err != nil {
+		if err := prop.oneofMarshaler(m, o); err == ErrNil {
+			return errOneofHasNil
+		} else if err != nil {
 			return err
 			return err
 		}
 		}
 	}
 	}
@@ -1230,6 +1264,9 @@ func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error {
 	// Add unrecognized fields at the end.
 	// Add unrecognized fields at the end.
 	if prop.unrecField.IsValid() {
 	if prop.unrecField.IsValid() {
 		v := *structPointer_Bytes(base, prop.unrecField)
 		v := *structPointer_Bytes(base, prop.unrecField)
+		if len(o.buf)+len(v) > maxMarshalSize {
+			return ErrTooLarge
+		}
 		if len(v) > 0 {
 		if len(v) > 0 {
 			o.buf = append(o.buf, v...)
 			o.buf = append(o.buf, v...)
 		}
 		}

+ 9 - 13
vendor/github.com/gogo/protobuf/proto/encode_gogo.go

@@ -1,7 +1,7 @@
-// Extensions for Protocol Buffers to create more go like structures.
+// Protocol Buffers for Go with Gadgets
 //
 //
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
 //
 //
 // Go support for Protocol Buffers - Google's data interchange format
 // Go support for Protocol Buffers - Google's data interchange format
 //
 //
@@ -196,12 +196,10 @@ func size_ref_struct_message(p *Properties, base structPointer) int {
 // Encode a slice of references to message struct pointers ([]struct).
 // Encode a slice of references to message struct pointers ([]struct).
 func (o *Buffer) enc_slice_ref_struct_message(p *Properties, base structPointer) error {
 func (o *Buffer) enc_slice_ref_struct_message(p *Properties, base structPointer) error {
 	var state errorState
 	var state errorState
-	ss := structPointer_GetStructPointer(base, p.field)
-	ss1 := structPointer_GetRefStructPointer(ss, field(0))
-	size := p.stype.Size()
-	l := structPointer_Len(base, p.field)
+	ss := structPointer_StructRefSlice(base, p.field, p.stype.Size())
+	l := ss.Len()
 	for i := 0; i < l; i++ {
 	for i := 0; i < l; i++ {
-		structp := structPointer_Add(ss1, field(uintptr(i)*size))
+		structp := ss.Index(i)
 		if structPointer_IsNil(structp) {
 		if structPointer_IsNil(structp) {
 			return errRepeatedHasNil
 			return errRepeatedHasNil
 		}
 		}
@@ -233,13 +231,11 @@ func (o *Buffer) enc_slice_ref_struct_message(p *Properties, base structPointer)
 
 
 //TODO this is only copied, please fix this
 //TODO this is only copied, please fix this
 func size_slice_ref_struct_message(p *Properties, base structPointer) (n int) {
 func size_slice_ref_struct_message(p *Properties, base structPointer) (n int) {
-	ss := structPointer_GetStructPointer(base, p.field)
-	ss1 := structPointer_GetRefStructPointer(ss, field(0))
-	size := p.stype.Size()
-	l := structPointer_Len(base, p.field)
+	ss := structPointer_StructRefSlice(base, p.field, p.stype.Size())
+	l := ss.Len()
 	n += l * len(p.tagcode)
 	n += l * len(p.tagcode)
 	for i := 0; i < l; i++ {
 	for i := 0; i < l; i++ {
-		structp := structPointer_Add(ss1, field(uintptr(i)*size))
+		structp := ss.Index(i)
 		if structPointer_IsNil(structp) {
 		if structPointer_IsNil(structp) {
 			return // return the size up to this point
 			return // return the size up to this point
 		}
 		}

+ 82 - 0
vendor/github.com/gogo/protobuf/proto/encode_test.go

@@ -0,0 +1,82 @@
+// Go support for Protocol Buffers - Google's data interchange format
+//
+// Copyright 2010 The Go Authors.  All rights reserved.
+// https://github.com/golang/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package proto_test
+
+import (
+	"testing"
+
+	"github.com/gogo/protobuf/proto"
+	tpb "github.com/gogo/protobuf/proto/proto3_proto"
+)
+
+var (
+	blackhole []byte
+)
+
+// Disabled this Benchmark because it is using features (b.Run) from go1.7 and gogoprotobuf still have compatibility with go1.5
+// BenchmarkAny creates increasingly large arbitrary Any messages.  The type is always the
+// same.
+// func BenchmarkAny(b *testing.B) {
+// 	data := make([]byte, 1<<20)
+// 	quantum := 1 << 10
+// 	for i := uint(0); i <= 10; i++ {
+// 		b.Run(strconv.Itoa(quantum<<i), func(b *testing.B) {
+// 			for k := 0; k < b.N; k++ {
+// 				inner := &tpb.Message{
+// 					Data: data[:quantum<<i],
+// 				}
+// 				outer, err := types.MarshalAny(inner)
+// 				if err != nil {
+// 					b.Error("wrong encode", err)
+// 				}
+// 				raw, err := proto.Marshal(&tpb.Message{
+// 					Anything: outer,
+// 				})
+// 				if err != nil {
+// 					b.Error("wrong encode", err)
+// 				}
+// 				blackhole = raw
+// 			}
+// 		})
+// 	}
+// }
+
+// BenchmarkEmpy measures the overhead of doing the minimal possible encode.
+func BenchmarkEmpy(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		raw, err := proto.Marshal(&tpb.Message{})
+		if err != nil {
+			b.Error("wrong encode", err)
+		}
+		blackhole = raw
+	}
+}

+ 29 - 5
vendor/github.com/gogo/protobuf/proto/equal.go

@@ -54,13 +54,17 @@ Equality is defined in this way:
     in a proto3 .proto file, fields are not "set"; specifically,
     in a proto3 .proto file, fields are not "set"; specifically,
     zero length proto3 "bytes" fields are equal (nil == {}).
     zero length proto3 "bytes" fields are equal (nil == {}).
   - Two repeated fields are equal iff their lengths are the same,
   - Two repeated fields are equal iff their lengths are the same,
-    and their corresponding elements are equal (a "bytes" field,
-    although represented by []byte, is not a repeated field)
+    and their corresponding elements are equal. Note a "bytes" field,
+    although represented by []byte, is not a repeated field and the
+    rule for the scalar fields described above applies.
   - Two unset fields are equal.
   - Two unset fields are equal.
   - Two unknown field sets are equal if their current
   - Two unknown field sets are equal if their current
     encoded state is equal.
     encoded state is equal.
   - Two extension sets are equal iff they have corresponding
   - Two extension sets are equal iff they have corresponding
     elements that are pairwise equal.
     elements that are pairwise equal.
+  - Two map fields are equal iff their lengths are the same,
+    and they contain the same set of elements. Zero-length map
+    fields are equal.
   - Every other combination of things are not equal.
   - Every other combination of things are not equal.
 
 
 The return value is undefined if a and b are not protocol buffers.
 The return value is undefined if a and b are not protocol buffers.
@@ -121,9 +125,16 @@ func equalStruct(v1, v2 reflect.Value) bool {
 		}
 		}
 	}
 	}
 
 
+	if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() {
+		em2 := v2.FieldByName("XXX_InternalExtensions")
+		if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) {
+			return false
+		}
+	}
+
 	if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() {
 	if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() {
 		em2 := v2.FieldByName("XXX_extensions")
 		em2 := v2.FieldByName("XXX_extensions")
-		if !equalExtensions(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) {
+		if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) {
 			return false
 			return false
 		}
 		}
 	}
 	}
@@ -184,6 +195,13 @@ func equalAny(v1, v2 reflect.Value, prop *Properties) bool {
 		}
 		}
 		return true
 		return true
 	case reflect.Ptr:
 	case reflect.Ptr:
+		// Maps may have nil values in them, so check for nil.
+		if v1.IsNil() && v2.IsNil() {
+			return true
+		}
+		if v1.IsNil() != v2.IsNil() {
+			return false
+		}
 		return equalAny(v1.Elem(), v2.Elem(), prop)
 		return equalAny(v1.Elem(), v2.Elem(), prop)
 	case reflect.Slice:
 	case reflect.Slice:
 		if v1.Type().Elem().Kind() == reflect.Uint8 {
 		if v1.Type().Elem().Kind() == reflect.Uint8 {
@@ -223,8 +241,14 @@ func equalAny(v1, v2 reflect.Value, prop *Properties) bool {
 }
 }
 
 
 // base is the struct type that the extensions are based on.
 // base is the struct type that the extensions are based on.
-// em1 and em2 are extension maps.
-func equalExtensions(base reflect.Type, em1, em2 map[int32]Extension) bool {
+// x1 and x2 are InternalExtensions.
+func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool {
+	em1, _ := x1.extensionsRead()
+	em2, _ := x2.extensionsRead()
+	return equalExtMap(base, em1, em2)
+}
+
+func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool {
 	if len(em1) != len(em2) {
 	if len(em1) != len(em2) {
 		return false
 		return false
 	}
 	}

+ 224 - 0
vendor/github.com/gogo/protobuf/proto/equal_test.go

@@ -0,0 +1,224 @@
+// Go support for Protocol Buffers - Google's data interchange format
+//
+// Copyright 2011 The Go Authors.  All rights reserved.
+// https://github.com/golang/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package proto_test
+
+import (
+	"testing"
+
+	. "github.com/gogo/protobuf/proto"
+	proto3pb "github.com/gogo/protobuf/proto/proto3_proto"
+	pb "github.com/gogo/protobuf/proto/testdata"
+)
+
+// Four identical base messages.
+// The init function adds extensions to some of them.
+var messageWithoutExtension = &pb.MyMessage{Count: Int32(7)}
+var messageWithExtension1a = &pb.MyMessage{Count: Int32(7)}
+var messageWithExtension1b = &pb.MyMessage{Count: Int32(7)}
+var messageWithExtension2 = &pb.MyMessage{Count: Int32(7)}
+
+// Two messages with non-message extensions.
+var messageWithInt32Extension1 = &pb.MyMessage{Count: Int32(8)}
+var messageWithInt32Extension2 = &pb.MyMessage{Count: Int32(8)}
+
+func init() {
+	ext1 := &pb.Ext{Data: String("Kirk")}
+	ext2 := &pb.Ext{Data: String("Picard")}
+
+	// messageWithExtension1a has ext1, but never marshals it.
+	if err := SetExtension(messageWithExtension1a, pb.E_Ext_More, ext1); err != nil {
+		panic("SetExtension on 1a failed: " + err.Error())
+	}
+
+	// messageWithExtension1b is the unmarshaled form of messageWithExtension1a.
+	if err := SetExtension(messageWithExtension1b, pb.E_Ext_More, ext1); err != nil {
+		panic("SetExtension on 1b failed: " + err.Error())
+	}
+	buf, err := Marshal(messageWithExtension1b)
+	if err != nil {
+		panic("Marshal of 1b failed: " + err.Error())
+	}
+	messageWithExtension1b.Reset()
+	if err := Unmarshal(buf, messageWithExtension1b); err != nil {
+		panic("Unmarshal of 1b failed: " + err.Error())
+	}
+
+	// messageWithExtension2 has ext2.
+	if err := SetExtension(messageWithExtension2, pb.E_Ext_More, ext2); err != nil {
+		panic("SetExtension on 2 failed: " + err.Error())
+	}
+
+	if err := SetExtension(messageWithInt32Extension1, pb.E_Ext_Number, Int32(23)); err != nil {
+		panic("SetExtension on Int32-1 failed: " + err.Error())
+	}
+	if err := SetExtension(messageWithInt32Extension1, pb.E_Ext_Number, Int32(24)); err != nil {
+		panic("SetExtension on Int32-2 failed: " + err.Error())
+	}
+}
+
+var EqualTests = []struct {
+	desc string
+	a, b Message
+	exp  bool
+}{
+	{"different types", &pb.GoEnum{}, &pb.GoTestField{}, false},
+	{"equal empty", &pb.GoEnum{}, &pb.GoEnum{}, true},
+	{"nil vs nil", nil, nil, true},
+	{"typed nil vs typed nil", (*pb.GoEnum)(nil), (*pb.GoEnum)(nil), true},
+	{"typed nil vs empty", (*pb.GoEnum)(nil), &pb.GoEnum{}, false},
+	{"different typed nil", (*pb.GoEnum)(nil), (*pb.GoTestField)(nil), false},
+
+	{"one set field, one unset field", &pb.GoTestField{Label: String("foo")}, &pb.GoTestField{}, false},
+	{"one set field zero, one unset field", &pb.GoTest{Param: Int32(0)}, &pb.GoTest{}, false},
+	{"different set fields", &pb.GoTestField{Label: String("foo")}, &pb.GoTestField{Label: String("bar")}, false},
+	{"equal set", &pb.GoTestField{Label: String("foo")}, &pb.GoTestField{Label: String("foo")}, true},
+
+	{"repeated, one set", &pb.GoTest{F_Int32Repeated: []int32{2, 3}}, &pb.GoTest{}, false},
+	{"repeated, different length", &pb.GoTest{F_Int32Repeated: []int32{2, 3}}, &pb.GoTest{F_Int32Repeated: []int32{2}}, false},
+	{"repeated, different value", &pb.GoTest{F_Int32Repeated: []int32{2}}, &pb.GoTest{F_Int32Repeated: []int32{3}}, false},
+	{"repeated, equal", &pb.GoTest{F_Int32Repeated: []int32{2, 4}}, &pb.GoTest{F_Int32Repeated: []int32{2, 4}}, true},
+	{"repeated, nil equal nil", &pb.GoTest{F_Int32Repeated: nil}, &pb.GoTest{F_Int32Repeated: nil}, true},
+	{"repeated, nil equal empty", &pb.GoTest{F_Int32Repeated: nil}, &pb.GoTest{F_Int32Repeated: []int32{}}, true},
+	{"repeated, empty equal nil", &pb.GoTest{F_Int32Repeated: []int32{}}, &pb.GoTest{F_Int32Repeated: nil}, true},
+
+	{
+		"nested, different",
+		&pb.GoTest{RequiredField: &pb.GoTestField{Label: String("foo")}},
+		&pb.GoTest{RequiredField: &pb.GoTestField{Label: String("bar")}},
+		false,
+	},
+	{
+		"nested, equal",
+		&pb.GoTest{RequiredField: &pb.GoTestField{Label: String("wow")}},
+		&pb.GoTest{RequiredField: &pb.GoTestField{Label: String("wow")}},
+		true,
+	},
+
+	{"bytes", &pb.OtherMessage{Value: []byte("foo")}, &pb.OtherMessage{Value: []byte("foo")}, true},
+	{"bytes, empty", &pb.OtherMessage{Value: []byte{}}, &pb.OtherMessage{Value: []byte{}}, true},
+	{"bytes, empty vs nil", &pb.OtherMessage{Value: []byte{}}, &pb.OtherMessage{Value: nil}, false},
+	{
+		"repeated bytes",
+		&pb.MyMessage{RepBytes: [][]byte{[]byte("sham"), []byte("wow")}},
+		&pb.MyMessage{RepBytes: [][]byte{[]byte("sham"), []byte("wow")}},
+		true,
+	},
+	// In proto3, []byte{} and []byte(nil) are equal.
+	{"proto3 bytes, empty vs nil", &proto3pb.Message{Data: []byte{}}, &proto3pb.Message{Data: nil}, true},
+
+	{"extension vs. no extension", messageWithoutExtension, messageWithExtension1a, false},
+	{"extension vs. same extension", messageWithExtension1a, messageWithExtension1b, true},
+	{"extension vs. different extension", messageWithExtension1a, messageWithExtension2, false},
+
+	{"int32 extension vs. itself", messageWithInt32Extension1, messageWithInt32Extension1, true},
+	{"int32 extension vs. a different int32", messageWithInt32Extension1, messageWithInt32Extension2, false},
+
+	{
+		"message with group",
+		&pb.MyMessage{
+			Count: Int32(1),
+			Somegroup: &pb.MyMessage_SomeGroup{
+				GroupField: Int32(5),
+			},
+		},
+		&pb.MyMessage{
+			Count: Int32(1),
+			Somegroup: &pb.MyMessage_SomeGroup{
+				GroupField: Int32(5),
+			},
+		},
+		true,
+	},
+
+	{
+		"map same",
+		&pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
+		&pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
+		true,
+	},
+	{
+		"map different entry",
+		&pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
+		&pb.MessageWithMap{NameMapping: map[int32]string{2: "Rob"}},
+		false,
+	},
+	{
+		"map different key only",
+		&pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
+		&pb.MessageWithMap{NameMapping: map[int32]string{2: "Ken"}},
+		false,
+	},
+	{
+		"map different value only",
+		&pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken"}},
+		&pb.MessageWithMap{NameMapping: map[int32]string{1: "Rob"}},
+		false,
+	},
+	{
+		"zero-length maps same",
+		&pb.MessageWithMap{NameMapping: map[int32]string{}},
+		&pb.MessageWithMap{NameMapping: nil},
+		true,
+	},
+	{
+		"orders in map don't matter",
+		&pb.MessageWithMap{NameMapping: map[int32]string{1: "Ken", 2: "Rob"}},
+		&pb.MessageWithMap{NameMapping: map[int32]string{2: "Rob", 1: "Ken"}},
+		true,
+	},
+	{
+		"oneof same",
+		&pb.Communique{Union: &pb.Communique_Number{Number: 41}},
+		&pb.Communique{Union: &pb.Communique_Number{Number: 41}},
+		true,
+	},
+	{
+		"oneof one nil",
+		&pb.Communique{Union: &pb.Communique_Number{Number: 41}},
+		&pb.Communique{},
+		false,
+	},
+	{
+		"oneof different",
+		&pb.Communique{Union: &pb.Communique_Number{Number: 41}},
+		&pb.Communique{Union: &pb.Communique_Name{Name: "Bobby Tables"}},
+		false,
+	},
+}
+
+func TestEqual(t *testing.T) {
+	for _, tc := range EqualTests {
+		if res := Equal(tc.a, tc.b); res != tc.exp {
+			t.Errorf("%v: Equal(%v, %v) = %v, want %v", tc.desc, tc.a, tc.b, res, tc.exp)
+		}
+	}
+}

+ 294 - 119
vendor/github.com/gogo/protobuf/proto/extensions.go

@@ -52,23 +52,112 @@ type ExtensionRange struct {
 	Start, End int32 // both inclusive
 	Start, End int32 // both inclusive
 }
 }
 
 
-// extendableProto is an interface implemented by any protocol buffer that may be extended.
+// extendableProto is an interface implemented by any protocol buffer generated by the current
+// proto compiler that may be extended.
 type extendableProto interface {
 type extendableProto interface {
 	Message
 	Message
 	ExtensionRangeArray() []ExtensionRange
 	ExtensionRangeArray() []ExtensionRange
+	extensionsWrite() map[int32]Extension
+	extensionsRead() (map[int32]Extension, sync.Locker)
 }
 }
 
 
-type extensionsMap interface {
-	extendableProto
+// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous
+// version of the proto compiler that may be extended.
+type extendableProtoV1 interface {
+	Message
+	ExtensionRangeArray() []ExtensionRange
 	ExtensionMap() map[int32]Extension
 	ExtensionMap() map[int32]Extension
 }
 }
 
 
 type extensionsBytes interface {
 type extensionsBytes interface {
-	extendableProto
+	Message
+	ExtensionRangeArray() []ExtensionRange
 	GetExtensions() *[]byte
 	GetExtensions() *[]byte
 }
 }
 
 
+// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto.
+type extensionAdapter struct {
+	extendableProtoV1
+}
+
+func (e extensionAdapter) extensionsWrite() map[int32]Extension {
+	return e.ExtensionMap()
+}
+
+func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) {
+	return e.ExtensionMap(), notLocker{}
+}
+
+// notLocker is a sync.Locker whose Lock and Unlock methods are nops.
+type notLocker struct{}
+
+func (n notLocker) Lock()   {}
+func (n notLocker) Unlock() {}
+
+// extendable returns the extendableProto interface for the given generated proto message.
+// If the proto message has the old extension format, it returns a wrapper that implements
+// the extendableProto interface.
+func extendable(p interface{}) (extendableProto, bool) {
+	if ep, ok := p.(extendableProto); ok {
+		return ep, ok
+	}
+	if ep, ok := p.(extendableProtoV1); ok {
+		return extensionAdapter{ep}, ok
+	}
+	return nil, false
+}
+
+// XXX_InternalExtensions is an internal representation of proto extensions.
+//
+// Each generated message struct type embeds an anonymous XXX_InternalExtensions field,
+// thus gaining the unexported 'extensions' method, which can be called only from the proto package.
+//
+// The methods of XXX_InternalExtensions are not concurrency safe in general,
+// but calls to logically read-only methods such as has and get may be executed concurrently.
+type XXX_InternalExtensions struct {
+	// The struct must be indirect so that if a user inadvertently copies a
+	// generated message and its embedded XXX_InternalExtensions, they
+	// avoid the mayhem of a copied mutex.
+	//
+	// The mutex serializes all logically read-only operations to p.extensionMap.
+	// It is up to the client to ensure that write operations to p.extensionMap are
+	// mutually exclusive with other accesses.
+	p *struct {
+		mu           sync.Mutex
+		extensionMap map[int32]Extension
+	}
+}
+
+// extensionsWrite returns the extension map, creating it on first use.
+func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension {
+	if e.p == nil {
+		e.p = new(struct {
+			mu           sync.Mutex
+			extensionMap map[int32]Extension
+		})
+		e.p.extensionMap = make(map[int32]Extension)
+	}
+	return e.p.extensionMap
+}
+
+// extensionsRead returns the extensions map for read-only use.  It may be nil.
+// The caller must hold the returned mutex's lock when accessing Elements within the map.
+func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) {
+	if e.p == nil {
+		return nil, nil
+	}
+	return e.p.extensionMap, &e.p.mu
+}
+
+type extensionRange interface {
+	Message
+	ExtensionRangeArray() []ExtensionRange
+}
+
 var extendableProtoType = reflect.TypeOf((*extendableProto)(nil)).Elem()
 var extendableProtoType = reflect.TypeOf((*extendableProto)(nil)).Elem()
+var extendableProtoV1Type = reflect.TypeOf((*extendableProtoV1)(nil)).Elem()
+var extendableBytesType = reflect.TypeOf((*extensionsBytes)(nil)).Elem()
+var extensionRangeType = reflect.TypeOf((*extensionRange)(nil)).Elem()
 
 
 // ExtensionDesc represents an extension specification.
 // ExtensionDesc represents an extension specification.
 // Used in generated code from the protocol compiler.
 // Used in generated code from the protocol compiler.
@@ -78,6 +167,7 @@ type ExtensionDesc struct {
 	Field         int32       // field number
 	Field         int32       // field number
 	Name          string      // fully-qualified name of extension, for text formatting
 	Name          string      // fully-qualified name of extension, for text formatting
 	Tag           string      // protobuf tag style
 	Tag           string      // protobuf tag style
+	Filename      string      // name of the file in which the extension is defined
 }
 }
 
 
 func (ed *ExtensionDesc) repeated() bool {
 func (ed *ExtensionDesc) repeated() bool {
@@ -101,20 +191,23 @@ type Extension struct {
 }
 }
 
 
 // SetRawExtension is for testing only.
 // SetRawExtension is for testing only.
-func SetRawExtension(base extendableProto, id int32, b []byte) {
-	if ebase, ok := base.(extensionsMap); ok {
-		ebase.ExtensionMap()[id] = Extension{enc: b}
-	} else if ebase, ok := base.(extensionsBytes); ok {
+func SetRawExtension(base Message, id int32, b []byte) {
+	if ebase, ok := base.(extensionsBytes); ok {
 		clearExtension(base, id)
 		clearExtension(base, id)
 		ext := ebase.GetExtensions()
 		ext := ebase.GetExtensions()
 		*ext = append(*ext, b...)
 		*ext = append(*ext, b...)
-	} else {
-		panic("unreachable")
+		return
+	}
+	epb, ok := extendable(base)
+	if !ok {
+		return
 	}
 	}
+	extmap := epb.extensionsWrite()
+	extmap[id] = Extension{enc: b}
 }
 }
 
 
 // isExtensionField returns true iff the given field number is in an extension range.
 // isExtensionField returns true iff the given field number is in an extension range.
-func isExtensionField(pb extendableProto, field int32) bool {
+func isExtensionField(pb extensionRange, field int32) bool {
 	for _, er := range pb.ExtensionRangeArray() {
 	for _, er := range pb.ExtensionRangeArray() {
 		if er.Start <= field && field <= er.End {
 		if er.Start <= field && field <= er.End {
 			return true
 			return true
@@ -125,8 +218,12 @@ func isExtensionField(pb extendableProto, field int32) bool {
 
 
 // checkExtensionTypes checks that the given extension is valid for pb.
 // checkExtensionTypes checks that the given extension is valid for pb.
 func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error {
 func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error {
+	var pbi interface{} = pb
 	// Check the extended type.
 	// Check the extended type.
-	if a, b := reflect.TypeOf(pb), reflect.TypeOf(extension.ExtendedType); a != b {
+	if ea, ok := pbi.(extensionAdapter); ok {
+		pbi = ea.extendableProtoV1
+	}
+	if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b {
 		return errors.New("proto: bad extended type; " + b.String() + " does not extend " + a.String())
 		return errors.New("proto: bad extended type; " + b.String() + " does not extend " + a.String())
 	}
 	}
 	// Check the range.
 	// Check the range.
@@ -172,43 +269,57 @@ func extensionProperties(ed *ExtensionDesc) *Properties {
 	return prop
 	return prop
 }
 }
 
 
-// encodeExtensionMap encodes any unmarshaled (unencoded) extensions in m.
-func encodeExtensionMap(m map[int32]Extension) error {
+// encode encodes any unmarshaled (unencoded) extensions in e.
+func encodeExtensions(e *XXX_InternalExtensions) error {
+	m, mu := e.extensionsRead()
+	if m == nil {
+		return nil // fast path
+	}
+	mu.Lock()
+	defer mu.Unlock()
+	return encodeExtensionsMap(m)
+}
+
+// encode encodes any unmarshaled (unencoded) extensions in e.
+func encodeExtensionsMap(m map[int32]Extension) error {
 	for k, e := range m {
 	for k, e := range m {
-		err := encodeExtension(&e)
-		if err != nil {
+		if e.value == nil || e.desc == nil {
+			// Extension is only in its encoded form.
+			continue
+		}
+
+		// We don't skip extensions that have an encoded form set,
+		// because the extension value may have been mutated after
+		// the last time this function was called.
+
+		et := reflect.TypeOf(e.desc.ExtensionType)
+		props := extensionProperties(e.desc)
+
+		p := NewBuffer(nil)
+		// If e.value has type T, the encoder expects a *struct{ X T }.
+		// Pass a *T with a zero field and hope it all works out.
+		x := reflect.New(et)
+		x.Elem().Set(reflect.ValueOf(e.value))
+		if err := props.enc(p, props, toStructPointer(x)); err != nil {
 			return err
 			return err
 		}
 		}
+		e.enc = p.buf
 		m[k] = e
 		m[k] = e
 	}
 	}
 	return nil
 	return nil
 }
 }
 
 
-func encodeExtension(e *Extension) error {
-	if e.value == nil || e.desc == nil {
-		// Extension is only in its encoded form.
-		return nil
-	}
-	// We don't skip extensions that have an encoded form set,
-	// because the extension value may have been mutated after
-	// the last time this function was called.
-
-	et := reflect.TypeOf(e.desc.ExtensionType)
-	props := extensionProperties(e.desc)
-
-	p := NewBuffer(nil)
-	// If e.value has type T, the encoder expects a *struct{ X T }.
-	// Pass a *T with a zero field and hope it all works out.
-	x := reflect.New(et)
-	x.Elem().Set(reflect.ValueOf(e.value))
-	if err := props.enc(p, props, toStructPointer(x)); err != nil {
-		return err
+func extensionsSize(e *XXX_InternalExtensions) (n int) {
+	m, mu := e.extensionsRead()
+	if m == nil {
+		return 0
 	}
 	}
-	e.enc = p.buf
-	return nil
+	mu.Lock()
+	defer mu.Unlock()
+	return extensionsMapSize(m)
 }
 }
 
 
-func sizeExtensionMap(m map[int32]Extension) (n int) {
+func extensionsMapSize(m map[int32]Extension) (n int) {
 	for _, e := range m {
 	for _, e := range m {
 		if e.value == nil || e.desc == nil {
 		if e.value == nil || e.desc == nil {
 			// Extension is only in its encoded form.
 			// Extension is only in its encoded form.
@@ -233,12 +344,8 @@ func sizeExtensionMap(m map[int32]Extension) (n int) {
 }
 }
 
 
 // HasExtension returns whether the given extension is present in pb.
 // HasExtension returns whether the given extension is present in pb.
-func HasExtension(pb extendableProto, extension *ExtensionDesc) bool {
-	// TODO: Check types, field numbers, etc.?
-	if epb, doki := pb.(extensionsMap); doki {
-		_, ok := epb.ExtensionMap()[extension.Field]
-		return ok
-	} else if epb, doki := pb.(extensionsBytes); doki {
+func HasExtension(pb Message, extension *ExtensionDesc) bool {
+	if epb, doki := pb.(extensionsBytes); doki {
 		ext := epb.GetExtensions()
 		ext := epb.GetExtensions()
 		buf := *ext
 		buf := *ext
 		o := 0
 		o := 0
@@ -258,7 +365,19 @@ func HasExtension(pb extendableProto, extension *ExtensionDesc) bool {
 		}
 		}
 		return false
 		return false
 	}
 	}
-	panic("unreachable")
+	// TODO: Check types, field numbers, etc.?
+	epb, ok := extendable(pb)
+	if !ok {
+		return false
+	}
+	extmap, mu := epb.extensionsRead()
+	if extmap == nil {
+		return false
+	}
+	mu.Lock()
+	_, ok = extmap[extension.Field]
+	mu.Unlock()
+	return ok
 }
 }
 
 
 func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int {
 func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int {
@@ -281,64 +400,32 @@ func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int {
 	return -1
 	return -1
 }
 }
 
 
-func clearExtension(pb extendableProto, fieldNum int32) {
-	if epb, doki := pb.(extensionsMap); doki {
-		delete(epb.ExtensionMap(), fieldNum)
-	} else if epb, doki := pb.(extensionsBytes); doki {
+// ClearExtension removes the given extension from pb.
+func ClearExtension(pb Message, extension *ExtensionDesc) {
+	clearExtension(pb, extension.Field)
+}
+
+func clearExtension(pb Message, fieldNum int32) {
+	if epb, doki := pb.(extensionsBytes); doki {
 		offset := 0
 		offset := 0
 		for offset != -1 {
 		for offset != -1 {
 			offset = deleteExtension(epb, fieldNum, offset)
 			offset = deleteExtension(epb, fieldNum, offset)
 		}
 		}
-	} else {
-		panic("unreachable")
+		return
+	}
+	epb, ok := extendable(pb)
+	if !ok {
+		return
 	}
 	}
-}
-
-// ClearExtension removes the given extension from pb.
-func ClearExtension(pb extendableProto, extension *ExtensionDesc) {
 	// TODO: Check types, field numbers, etc.?
 	// TODO: Check types, field numbers, etc.?
-	clearExtension(pb, extension.Field)
+	extmap := epb.extensionsWrite()
+	delete(extmap, fieldNum)
 }
 }
 
 
 // GetExtension parses and returns the given extension of pb.
 // GetExtension parses and returns the given extension of pb.
-// If the extension is not present it returns ErrMissingExtension.
-func GetExtension(pb extendableProto, extension *ExtensionDesc) (interface{}, error) {
-	if err := checkExtensionTypes(pb, extension); err != nil {
-		return nil, err
-	}
-
-	if epb, doki := pb.(extensionsMap); doki {
-		emap := epb.ExtensionMap()
-		e, ok := emap[extension.Field]
-		if !ok {
-			// defaultExtensionValue returns the default value or
-			// ErrMissingExtension if there is no default.
-			return defaultExtensionValue(extension)
-		}
-		if e.value != nil {
-			// Already decoded. Check the descriptor, though.
-			if e.desc != extension {
-				// This shouldn't happen. If it does, it means that
-				// GetExtension was called twice with two different
-				// descriptors with the same field number.
-				return nil, errors.New("proto: descriptor conflict")
-			}
-			return e.value, nil
-		}
-
-		v, err := decodeExtension(e.enc, extension)
-		if err != nil {
-			return nil, err
-		}
-
-		// Remember the decoded version and drop the encoded version.
-		// That way it is safe to mutate what we return.
-		e.value = v
-		e.desc = extension
-		e.enc = nil
-		emap[extension.Field] = e
-		return e.value, nil
-	} else if epb, doki := pb.(extensionsBytes); doki {
+// If the extension is not present and has no default value it returns ErrMissingExtension.
+func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) {
+	if epb, doki := pb.(extensionsBytes); doki {
 		ext := epb.GetExtensions()
 		ext := epb.GetExtensions()
 		o := 0
 		o := 0
 		for o < len(*ext) {
 		for o < len(*ext) {
@@ -360,7 +447,50 @@ func GetExtension(pb extendableProto, extension *ExtensionDesc) (interface{}, er
 		}
 		}
 		return defaultExtensionValue(extension)
 		return defaultExtensionValue(extension)
 	}
 	}
-	panic("unreachable")
+	epb, ok := extendable(pb)
+	if !ok {
+		return nil, errors.New("proto: not an extendable proto")
+	}
+	if err := checkExtensionTypes(epb, extension); err != nil {
+		return nil, err
+	}
+
+	emap, mu := epb.extensionsRead()
+	if emap == nil {
+		return defaultExtensionValue(extension)
+	}
+	mu.Lock()
+	defer mu.Unlock()
+	e, ok := emap[extension.Field]
+	if !ok {
+		// defaultExtensionValue returns the default value or
+		// ErrMissingExtension if there is no default.
+		return defaultExtensionValue(extension)
+	}
+
+	if e.value != nil {
+		// Already decoded. Check the descriptor, though.
+		if e.desc != extension {
+			// This shouldn't happen. If it does, it means that
+			// GetExtension was called twice with two different
+			// descriptors with the same field number.
+			return nil, errors.New("proto: descriptor conflict")
+		}
+		return e.value, nil
+	}
+
+	v, err := decodeExtension(e.enc, extension)
+	if err != nil {
+		return nil, err
+	}
+
+	// Remember the decoded version and drop the encoded version.
+	// That way it is safe to mutate what we return.
+	e.value = v
+	e.desc = extension
+	e.enc = nil
+	emap[extension.Field] = e
+	return e.value, nil
 }
 }
 
 
 // defaultExtensionValue returns the default value for extension.
 // defaultExtensionValue returns the default value for extension.
@@ -434,14 +564,9 @@ func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) {
 // GetExtensions returns a slice of the extensions present in pb that are also listed in es.
 // GetExtensions returns a slice of the extensions present in pb that are also listed in es.
 // The returned slice has the same length as es; missing extensions will appear as nil elements.
 // The returned slice has the same length as es; missing extensions will appear as nil elements.
 func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) {
 func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) {
-	epb, ok := pb.(extendableProto)
-	if !ok {
-		err = errors.New("proto: not an extendable proto")
-		return
-	}
 	extensions = make([]interface{}, len(es))
 	extensions = make([]interface{}, len(es))
 	for i, e := range es {
 	for i, e := range es {
-		extensions[i], err = GetExtension(epb, e)
+		extensions[i], err = GetExtension(pb, e)
 		if err == ErrMissingExtension {
 		if err == ErrMissingExtension {
 			err = nil
 			err = nil
 		}
 		}
@@ -452,9 +577,58 @@ func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, e
 	return
 	return
 }
 }
 
 
+// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order.
+// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing
+// just the Field field, which defines the extension's field number.
+func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) {
+	epb, ok := extendable(pb)
+	if !ok {
+		return nil, fmt.Errorf("proto: %T is not an extendable proto.Message", pb)
+	}
+	registeredExtensions := RegisteredExtensions(pb)
+
+	emap, mu := epb.extensionsRead()
+	if emap == nil {
+		return nil, nil
+	}
+	mu.Lock()
+	defer mu.Unlock()
+	extensions := make([]*ExtensionDesc, 0, len(emap))
+	for extid, e := range emap {
+		desc := e.desc
+		if desc == nil {
+			desc = registeredExtensions[extid]
+			if desc == nil {
+				desc = &ExtensionDesc{Field: extid}
+			}
+		}
+
+		extensions = append(extensions, desc)
+	}
+	return extensions, nil
+}
+
 // SetExtension sets the specified extension of pb to the specified value.
 // SetExtension sets the specified extension of pb to the specified value.
-func SetExtension(pb extendableProto, extension *ExtensionDesc, value interface{}) error {
-	if err := checkExtensionTypes(pb, extension); err != nil {
+func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error {
+	if epb, doki := pb.(extensionsBytes); doki {
+		ClearExtension(pb, extension)
+		ext := epb.GetExtensions()
+		et := reflect.TypeOf(extension.ExtensionType)
+		props := extensionProperties(extension)
+		p := NewBuffer(nil)
+		x := reflect.New(et)
+		x.Elem().Set(reflect.ValueOf(value))
+		if err := props.enc(p, props, toStructPointer(x)); err != nil {
+			return err
+		}
+		*ext = append(*ext, p.buf...)
+		return nil
+	}
+	epb, ok := extendable(pb)
+	if !ok {
+		return errors.New("proto: not an extendable proto")
+	}
+	if err := checkExtensionTypes(epb, extension); err != nil {
 		return err
 		return err
 	}
 	}
 	typ := reflect.TypeOf(extension.ExtensionType)
 	typ := reflect.TypeOf(extension.ExtensionType)
@@ -469,26 +643,27 @@ func SetExtension(pb extendableProto, extension *ExtensionDesc, value interface{
 	if reflect.ValueOf(value).IsNil() {
 	if reflect.ValueOf(value).IsNil() {
 		return fmt.Errorf("proto: SetExtension called with nil value of type %T", value)
 		return fmt.Errorf("proto: SetExtension called with nil value of type %T", value)
 	}
 	}
-	return setExtension(pb, extension, value)
+
+	extmap := epb.extensionsWrite()
+	extmap[extension.Field] = Extension{desc: extension, value: value}
+	return nil
 }
 }
 
 
-func setExtension(pb extendableProto, extension *ExtensionDesc, value interface{}) error {
-	if epb, doki := pb.(extensionsMap); doki {
-		epb.ExtensionMap()[extension.Field] = Extension{desc: extension, value: value}
-	} else if epb, doki := pb.(extensionsBytes); doki {
-		ClearExtension(pb, extension)
+// ClearAllExtensions clears all extensions from pb.
+func ClearAllExtensions(pb Message) {
+	if epb, doki := pb.(extensionsBytes); doki {
 		ext := epb.GetExtensions()
 		ext := epb.GetExtensions()
-		et := reflect.TypeOf(extension.ExtensionType)
-		props := extensionProperties(extension)
-		p := NewBuffer(nil)
-		x := reflect.New(et)
-		x.Elem().Set(reflect.ValueOf(value))
-		if err := props.enc(p, props, toStructPointer(x)); err != nil {
-			return err
-		}
-		*ext = append(*ext, p.buf...)
+		*ext = []byte{}
+		return
+	}
+	epb, ok := extendable(pb)
+	if !ok {
+		return
+	}
+	m := epb.extensionsWrite()
+	for k := range m {
+		delete(m, k)
 	}
 	}
-	return nil
 }
 }
 
 
 // A global registry of extensions.
 // A global registry of extensions.

+ 73 - 15
vendor/github.com/gogo/protobuf/proto/extensions_gogo.go

@@ -1,5 +1,7 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // modification, are permitted provided that the following conditions are
@@ -33,9 +35,10 @@ import (
 	"reflect"
 	"reflect"
 	"sort"
 	"sort"
 	"strings"
 	"strings"
+	"sync"
 )
 )
 
 
-func GetBoolExtension(pb extendableProto, extension *ExtensionDesc, ifnotset bool) bool {
+func GetBoolExtension(pb Message, extension *ExtensionDesc, ifnotset bool) bool {
 	if reflect.ValueOf(pb).IsNil() {
 	if reflect.ValueOf(pb).IsNil() {
 		return ifnotset
 		return ifnotset
 	}
 	}
@@ -60,8 +63,12 @@ func (this *Extension) Compare(that *Extension) int {
 	return bytes.Compare(this.enc, that.enc)
 	return bytes.Compare(this.enc, that.enc)
 }
 }
 
 
+func SizeOfInternalExtension(m extendableProto) (n int) {
+	return SizeOfExtensionMap(m.extensionsWrite())
+}
+
 func SizeOfExtensionMap(m map[int32]Extension) (n int) {
 func SizeOfExtensionMap(m map[int32]Extension) (n int) {
-	return sizeExtensionMap(m)
+	return extensionsMapSize(m)
 }
 }
 
 
 type sortableMapElem struct {
 type sortableMapElem struct {
@@ -94,6 +101,10 @@ func (this sortableExtensions) String() string {
 	return "map[" + strings.Join(ss, ",") + "]"
 	return "map[" + strings.Join(ss, ",") + "]"
 }
 }
 
 
+func StringFromInternalExtension(m extendableProto) string {
+	return StringFromExtensionsMap(m.extensionsWrite())
+}
+
 func StringFromExtensionsMap(m map[int32]Extension) string {
 func StringFromExtensionsMap(m map[int32]Extension) string {
 	return newSortableExtensionsFromMap(m).String()
 	return newSortableExtensionsFromMap(m).String()
 }
 }
@@ -106,8 +117,12 @@ func StringFromExtensionsBytes(ext []byte) string {
 	return StringFromExtensionsMap(m)
 	return StringFromExtensionsMap(m)
 }
 }
 
 
+func EncodeInternalExtension(m extendableProto, data []byte) (n int, err error) {
+	return EncodeExtensionMap(m.extensionsWrite(), data)
+}
+
 func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) {
 func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) {
-	if err := encodeExtensionMap(m); err != nil {
+	if err := encodeExtensionsMap(m); err != nil {
 		return 0, err
 		return 0, err
 	}
 	}
 	keys := make([]int, 0, len(m))
 	keys := make([]int, 0, len(m))
@@ -125,7 +140,7 @@ func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) {
 	if m[id].value == nil || m[id].desc == nil {
 	if m[id].value == nil || m[id].desc == nil {
 		return m[id].enc, nil
 		return m[id].enc, nil
 	}
 	}
-	if err := encodeExtensionMap(m); err != nil {
+	if err := encodeExtensionsMap(m); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
 	return m[id].enc, nil
 	return m[id].enc, nil
@@ -189,17 +204,44 @@ func NewExtension(e []byte) Extension {
 	return ee
 	return ee
 }
 }
 
 
-func AppendExtension(e extendableProto, tag int32, buf []byte) {
-	if ee, eok := e.(extensionsMap); eok {
-		ext := ee.ExtensionMap()[int32(tag)] // may be missing
-		ext.enc = append(ext.enc, buf...)
-		ee.ExtensionMap()[int32(tag)] = ext
-	} else if ee, eok := e.(extensionsBytes); eok {
+func AppendExtension(e Message, tag int32, buf []byte) {
+	if ee, eok := e.(extensionsBytes); eok {
 		ext := ee.GetExtensions()
 		ext := ee.GetExtensions()
 		*ext = append(*ext, buf...)
 		*ext = append(*ext, buf...)
+		return
+	}
+	if ee, eok := e.(extendableProto); eok {
+		m := ee.extensionsWrite()
+		ext := m[int32(tag)] // may be missing
+		ext.enc = append(ext.enc, buf...)
+		m[int32(tag)] = ext
 	}
 	}
 }
 }
 
 
+func encodeExtension(e *Extension) error {
+	if e.value == nil || e.desc == nil {
+		// Extension is only in its encoded form.
+		return nil
+	}
+	// We don't skip extensions that have an encoded form set,
+	// because the extension value may have been mutated after
+	// the last time this function was called.
+
+	et := reflect.TypeOf(e.desc.ExtensionType)
+	props := extensionProperties(e.desc)
+
+	p := NewBuffer(nil)
+	// If e.value has type T, the encoder expects a *struct{ X T }.
+	// Pass a *T with a zero field and hope it all works out.
+	x := reflect.New(et)
+	x.Elem().Set(reflect.ValueOf(e.value))
+	if err := props.enc(p, props, toStructPointer(x)); err != nil {
+		return err
+	}
+	e.enc = p.buf
+	return nil
+}
+
 func (this Extension) GoString() string {
 func (this Extension) GoString() string {
 	if this.enc == nil {
 	if this.enc == nil {
 		if err := encodeExtension(&this); err != nil {
 		if err := encodeExtension(&this); err != nil {
@@ -209,7 +251,7 @@ func (this Extension) GoString() string {
 	return fmt.Sprintf("proto.NewExtension(%#v)", this.enc)
 	return fmt.Sprintf("proto.NewExtension(%#v)", this.enc)
 }
 }
 
 
-func SetUnsafeExtension(pb extendableProto, fieldNum int32, value interface{}) error {
+func SetUnsafeExtension(pb Message, fieldNum int32, value interface{}) error {
 	typ := reflect.TypeOf(pb).Elem()
 	typ := reflect.TypeOf(pb).Elem()
 	ext, ok := extensionMaps[typ]
 	ext, ok := extensionMaps[typ]
 	if !ok {
 	if !ok {
@@ -219,10 +261,10 @@ func SetUnsafeExtension(pb extendableProto, fieldNum int32, value interface{}) e
 	if !ok {
 	if !ok {
 		return errors.New("proto: bad extension number; not in declared ranges")
 		return errors.New("proto: bad extension number; not in declared ranges")
 	}
 	}
-	return setExtension(pb, desc, value)
+	return SetExtension(pb, desc, value)
 }
 }
 
 
-func GetUnsafeExtension(pb extendableProto, fieldNum int32) (interface{}, error) {
+func GetUnsafeExtension(pb Message, fieldNum int32) (interface{}, error) {
 	typ := reflect.TypeOf(pb).Elem()
 	typ := reflect.TypeOf(pb).Elem()
 	ext, ok := extensionMaps[typ]
 	ext, ok := extensionMaps[typ]
 	if !ok {
 	if !ok {
@@ -234,3 +276,19 @@ func GetUnsafeExtension(pb extendableProto, fieldNum int32) (interface{}, error)
 	}
 	}
 	return GetExtension(pb, desc)
 	return GetExtension(pb, desc)
 }
 }
+
+func NewUnsafeXXX_InternalExtensions(m map[int32]Extension) XXX_InternalExtensions {
+	x := &XXX_InternalExtensions{
+		p: new(struct {
+			mu           sync.Mutex
+			extensionMap map[int32]Extension
+		}),
+	}
+	x.p.extensionMap = m
+	return *x
+}
+
+func GetUnsafeExtensionsMap(extendable Message) map[int32]Extension {
+	pb := extendable.(extendableProto)
+	return pb.extensionsWrite()
+}

+ 538 - 0
vendor/github.com/gogo/protobuf/proto/extensions_test.go

@@ -0,0 +1,538 @@
+// Go support for Protocol Buffers - Google's data interchange format
+//
+// Copyright 2014 The Go Authors.  All rights reserved.
+// https://github.com/golang/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package proto_test
+
+import (
+	"bytes"
+	"fmt"
+	"reflect"
+	"sort"
+	"testing"
+
+	"github.com/gogo/protobuf/proto"
+	pb "github.com/gogo/protobuf/proto/testdata"
+)
+
+func TestGetExtensionsWithMissingExtensions(t *testing.T) {
+	msg := &pb.MyMessage{}
+	ext1 := &pb.Ext{}
+	if err := proto.SetExtension(msg, pb.E_Ext_More, ext1); err != nil {
+		t.Fatalf("Could not set ext1: %s", err)
+	}
+	exts, err := proto.GetExtensions(msg, []*proto.ExtensionDesc{
+		pb.E_Ext_More,
+		pb.E_Ext_Text,
+	})
+	if err != nil {
+		t.Fatalf("GetExtensions() failed: %s", err)
+	}
+	if exts[0] != ext1 {
+		t.Errorf("ext1 not in returned extensions: %T %v", exts[0], exts[0])
+	}
+	if exts[1] != nil {
+		t.Errorf("ext2 in returned extensions: %T %v", exts[1], exts[1])
+	}
+}
+
+func TestExtensionDescsWithMissingExtensions(t *testing.T) {
+	msg := &pb.MyMessage{Count: proto.Int32(0)}
+	extdesc1 := pb.E_Ext_More
+	if descs, err := proto.ExtensionDescs(msg); len(descs) != 0 || err != nil {
+		t.Errorf("proto.ExtensionDescs: got %d descs, error %v; want 0, nil", len(descs), err)
+	}
+
+	ext1 := &pb.Ext{}
+	if err := proto.SetExtension(msg, extdesc1, ext1); err != nil {
+		t.Fatalf("Could not set ext1: %s", err)
+	}
+	extdesc2 := &proto.ExtensionDesc{
+		ExtendedType:  (*pb.MyMessage)(nil),
+		ExtensionType: (*bool)(nil),
+		Field:         123456789,
+		Name:          "a.b",
+		Tag:           "varint,123456789,opt",
+	}
+	ext2 := proto.Bool(false)
+	if err := proto.SetExtension(msg, extdesc2, ext2); err != nil {
+		t.Fatalf("Could not set ext2: %s", err)
+	}
+
+	b, err := proto.Marshal(msg)
+	if err != nil {
+		t.Fatalf("Could not marshal msg: %v", err)
+	}
+	if err = proto.Unmarshal(b, msg); err != nil {
+		t.Fatalf("Could not unmarshal into msg: %v", err)
+	}
+
+	descs, err := proto.ExtensionDescs(msg)
+	if err != nil {
+		t.Fatalf("proto.ExtensionDescs: got error %v", err)
+	}
+	sortExtDescs(descs)
+	wantDescs := []*proto.ExtensionDesc{extdesc1, {Field: extdesc2.Field}}
+	if !reflect.DeepEqual(descs, wantDescs) {
+		t.Errorf("proto.ExtensionDescs(msg) sorted extension ids: got %+v, want %+v", descs, wantDescs)
+	}
+}
+
+type ExtensionDescSlice []*proto.ExtensionDesc
+
+func (s ExtensionDescSlice) Len() int           { return len(s) }
+func (s ExtensionDescSlice) Less(i, j int) bool { return s[i].Field < s[j].Field }
+func (s ExtensionDescSlice) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
+
+func sortExtDescs(s []*proto.ExtensionDesc) {
+	sort.Sort(ExtensionDescSlice(s))
+}
+
+func TestGetExtensionStability(t *testing.T) {
+	check := func(m *pb.MyMessage) bool {
+		ext1, err := proto.GetExtension(m, pb.E_Ext_More)
+		if err != nil {
+			t.Fatalf("GetExtension() failed: %s", err)
+		}
+		ext2, err := proto.GetExtension(m, pb.E_Ext_More)
+		if err != nil {
+			t.Fatalf("GetExtension() failed: %s", err)
+		}
+		return ext1 == ext2
+	}
+	msg := &pb.MyMessage{Count: proto.Int32(4)}
+	ext0 := &pb.Ext{}
+	if err := proto.SetExtension(msg, pb.E_Ext_More, ext0); err != nil {
+		t.Fatalf("Could not set ext1: %s", ext0)
+	}
+	if !check(msg) {
+		t.Errorf("GetExtension() not stable before marshaling")
+	}
+	bb, err := proto.Marshal(msg)
+	if err != nil {
+		t.Fatalf("Marshal() failed: %s", err)
+	}
+	msg1 := &pb.MyMessage{}
+	err = proto.Unmarshal(bb, msg1)
+	if err != nil {
+		t.Fatalf("Unmarshal() failed: %s", err)
+	}
+	if !check(msg1) {
+		t.Errorf("GetExtension() not stable after unmarshaling")
+	}
+}
+
+func TestGetExtensionDefaults(t *testing.T) {
+	var setFloat64 float64 = 1
+	var setFloat32 float32 = 2
+	var setInt32 int32 = 3
+	var setInt64 int64 = 4
+	var setUint32 uint32 = 5
+	var setUint64 uint64 = 6
+	var setBool = true
+	var setBool2 = false
+	var setString = "Goodnight string"
+	var setBytes = []byte("Goodnight bytes")
+	var setEnum = pb.DefaultsMessage_TWO
+
+	type testcase struct {
+		ext  *proto.ExtensionDesc // Extension we are testing.
+		want interface{}          // Expected value of extension, or nil (meaning that GetExtension will fail).
+		def  interface{}          // Expected value of extension after ClearExtension().
+	}
+	tests := []testcase{
+		{pb.E_NoDefaultDouble, setFloat64, nil},
+		{pb.E_NoDefaultFloat, setFloat32, nil},
+		{pb.E_NoDefaultInt32, setInt32, nil},
+		{pb.E_NoDefaultInt64, setInt64, nil},
+		{pb.E_NoDefaultUint32, setUint32, nil},
+		{pb.E_NoDefaultUint64, setUint64, nil},
+		{pb.E_NoDefaultSint32, setInt32, nil},
+		{pb.E_NoDefaultSint64, setInt64, nil},
+		{pb.E_NoDefaultFixed32, setUint32, nil},
+		{pb.E_NoDefaultFixed64, setUint64, nil},
+		{pb.E_NoDefaultSfixed32, setInt32, nil},
+		{pb.E_NoDefaultSfixed64, setInt64, nil},
+		{pb.E_NoDefaultBool, setBool, nil},
+		{pb.E_NoDefaultBool, setBool2, nil},
+		{pb.E_NoDefaultString, setString, nil},
+		{pb.E_NoDefaultBytes, setBytes, nil},
+		{pb.E_NoDefaultEnum, setEnum, nil},
+		{pb.E_DefaultDouble, setFloat64, float64(3.1415)},
+		{pb.E_DefaultFloat, setFloat32, float32(3.14)},
+		{pb.E_DefaultInt32, setInt32, int32(42)},
+		{pb.E_DefaultInt64, setInt64, int64(43)},
+		{pb.E_DefaultUint32, setUint32, uint32(44)},
+		{pb.E_DefaultUint64, setUint64, uint64(45)},
+		{pb.E_DefaultSint32, setInt32, int32(46)},
+		{pb.E_DefaultSint64, setInt64, int64(47)},
+		{pb.E_DefaultFixed32, setUint32, uint32(48)},
+		{pb.E_DefaultFixed64, setUint64, uint64(49)},
+		{pb.E_DefaultSfixed32, setInt32, int32(50)},
+		{pb.E_DefaultSfixed64, setInt64, int64(51)},
+		{pb.E_DefaultBool, setBool, true},
+		{pb.E_DefaultBool, setBool2, true},
+		{pb.E_DefaultString, setString, "Hello, string"},
+		{pb.E_DefaultBytes, setBytes, []byte("Hello, bytes")},
+		{pb.E_DefaultEnum, setEnum, pb.DefaultsMessage_ONE},
+	}
+
+	checkVal := func(test testcase, msg *pb.DefaultsMessage, valWant interface{}) error {
+		val, err := proto.GetExtension(msg, test.ext)
+		if err != nil {
+			if valWant != nil {
+				return fmt.Errorf("GetExtension(): %s", err)
+			}
+			if want := proto.ErrMissingExtension; err != want {
+				return fmt.Errorf("Unexpected error: got %v, want %v", err, want)
+			}
+			return nil
+		}
+
+		// All proto2 extension values are either a pointer to a value or a slice of values.
+		ty := reflect.TypeOf(val)
+		tyWant := reflect.TypeOf(test.ext.ExtensionType)
+		if got, want := ty, tyWant; got != want {
+			return fmt.Errorf("unexpected reflect.TypeOf(): got %v want %v", got, want)
+		}
+		tye := ty.Elem()
+		tyeWant := tyWant.Elem()
+		if got, want := tye, tyeWant; got != want {
+			return fmt.Errorf("unexpected reflect.TypeOf().Elem(): got %v want %v", got, want)
+		}
+
+		// Check the name of the type of the value.
+		// If it is an enum it will be type int32 with the name of the enum.
+		if got, want := tye.Name(), tye.Name(); got != want {
+			return fmt.Errorf("unexpected reflect.TypeOf().Elem().Name(): got %v want %v", got, want)
+		}
+
+		// Check that value is what we expect.
+		// If we have a pointer in val, get the value it points to.
+		valExp := val
+		if ty.Kind() == reflect.Ptr {
+			valExp = reflect.ValueOf(val).Elem().Interface()
+		}
+		if got, want := valExp, valWant; !reflect.DeepEqual(got, want) {
+			return fmt.Errorf("unexpected reflect.DeepEqual(): got %v want %v", got, want)
+		}
+
+		return nil
+	}
+
+	setTo := func(test testcase) interface{} {
+		setTo := reflect.ValueOf(test.want)
+		if typ := reflect.TypeOf(test.ext.ExtensionType); typ.Kind() == reflect.Ptr {
+			setTo = reflect.New(typ).Elem()
+			setTo.Set(reflect.New(setTo.Type().Elem()))
+			setTo.Elem().Set(reflect.ValueOf(test.want))
+		}
+		return setTo.Interface()
+	}
+
+	for _, test := range tests {
+		msg := &pb.DefaultsMessage{}
+		name := test.ext.Name
+
+		// Check the initial value.
+		if err := checkVal(test, msg, test.def); err != nil {
+			t.Errorf("%s: %v", name, err)
+		}
+
+		// Set the per-type value and check value.
+		name = fmt.Sprintf("%s (set to %T %v)", name, test.want, test.want)
+		if err := proto.SetExtension(msg, test.ext, setTo(test)); err != nil {
+			t.Errorf("%s: SetExtension(): %v", name, err)
+			continue
+		}
+		if err := checkVal(test, msg, test.want); err != nil {
+			t.Errorf("%s: %v", name, err)
+			continue
+		}
+
+		// Set and check the value.
+		name += " (cleared)"
+		proto.ClearExtension(msg, test.ext)
+		if err := checkVal(test, msg, test.def); err != nil {
+			t.Errorf("%s: %v", name, err)
+		}
+	}
+}
+
+func TestExtensionsRoundTrip(t *testing.T) {
+	msg := &pb.MyMessage{}
+	ext1 := &pb.Ext{
+		Data: proto.String("hi"),
+	}
+	ext2 := &pb.Ext{
+		Data: proto.String("there"),
+	}
+	exists := proto.HasExtension(msg, pb.E_Ext_More)
+	if exists {
+		t.Error("Extension More present unexpectedly")
+	}
+	if err := proto.SetExtension(msg, pb.E_Ext_More, ext1); err != nil {
+		t.Error(err)
+	}
+	if err := proto.SetExtension(msg, pb.E_Ext_More, ext2); err != nil {
+		t.Error(err)
+	}
+	e, err := proto.GetExtension(msg, pb.E_Ext_More)
+	if err != nil {
+		t.Error(err)
+	}
+	x, ok := e.(*pb.Ext)
+	if !ok {
+		t.Errorf("e has type %T, expected testdata.Ext", e)
+	} else if *x.Data != "there" {
+		t.Errorf("SetExtension failed to overwrite, got %+v, not 'there'", x)
+	}
+	proto.ClearExtension(msg, pb.E_Ext_More)
+	if _, err = proto.GetExtension(msg, pb.E_Ext_More); err != proto.ErrMissingExtension {
+		t.Errorf("got %v, expected ErrMissingExtension", e)
+	}
+	if _, err := proto.GetExtension(msg, pb.E_X215); err == nil {
+		t.Error("expected bad extension error, got nil")
+	}
+	if err := proto.SetExtension(msg, pb.E_X215, 12); err == nil {
+		t.Error("expected extension err")
+	}
+	if err := proto.SetExtension(msg, pb.E_Ext_More, 12); err == nil {
+		t.Error("expected some sort of type mismatch error, got nil")
+	}
+}
+
+func TestNilExtension(t *testing.T) {
+	msg := &pb.MyMessage{
+		Count: proto.Int32(1),
+	}
+	if err := proto.SetExtension(msg, pb.E_Ext_Text, proto.String("hello")); err != nil {
+		t.Fatal(err)
+	}
+	if err := proto.SetExtension(msg, pb.E_Ext_More, (*pb.Ext)(nil)); err == nil {
+		t.Error("expected SetExtension to fail due to a nil extension")
+	} else if want := "proto: SetExtension called with nil value of type *testdata.Ext"; err.Error() != want {
+		t.Errorf("expected error %v, got %v", want, err)
+	}
+	// Note: if the behavior of Marshal is ever changed to ignore nil extensions, update
+	// this test to verify that E_Ext_Text is properly propagated through marshal->unmarshal.
+}
+
+func TestMarshalUnmarshalRepeatedExtension(t *testing.T) {
+	// Add a repeated extension to the result.
+	tests := []struct {
+		name string
+		ext  []*pb.ComplexExtension
+	}{
+		{
+			"two fields",
+			[]*pb.ComplexExtension{
+				{First: proto.Int32(7)},
+				{Second: proto.Int32(11)},
+			},
+		},
+		{
+			"repeated field",
+			[]*pb.ComplexExtension{
+				{Third: []int32{1000}},
+				{Third: []int32{2000}},
+			},
+		},
+		{
+			"two fields and repeated field",
+			[]*pb.ComplexExtension{
+				{Third: []int32{1000}},
+				{First: proto.Int32(9)},
+				{Second: proto.Int32(21)},
+				{Third: []int32{2000}},
+			},
+		},
+	}
+	for _, test := range tests {
+		// Marshal message with a repeated extension.
+		msg1 := new(pb.OtherMessage)
+		err := proto.SetExtension(msg1, pb.E_RComplex, test.ext)
+		if err != nil {
+			t.Fatalf("[%s] Error setting extension: %v", test.name, err)
+		}
+		b, err := proto.Marshal(msg1)
+		if err != nil {
+			t.Fatalf("[%s] Error marshaling message: %v", test.name, err)
+		}
+
+		// Unmarshal and read the merged proto.
+		msg2 := new(pb.OtherMessage)
+		err = proto.Unmarshal(b, msg2)
+		if err != nil {
+			t.Fatalf("[%s] Error unmarshaling message: %v", test.name, err)
+		}
+		e, err := proto.GetExtension(msg2, pb.E_RComplex)
+		if err != nil {
+			t.Fatalf("[%s] Error getting extension: %v", test.name, err)
+		}
+		ext := e.([]*pb.ComplexExtension)
+		if ext == nil {
+			t.Fatalf("[%s] Invalid extension", test.name)
+		}
+		if !reflect.DeepEqual(ext, test.ext) {
+			t.Errorf("[%s] Wrong value for ComplexExtension: got: %v want: %v\n", test.name, ext, test.ext)
+		}
+	}
+}
+
+func TestUnmarshalRepeatingNonRepeatedExtension(t *testing.T) {
+	// We may see multiple instances of the same extension in the wire
+	// format. For example, the proto compiler may encode custom options in
+	// this way. Here, we verify that we merge the extensions together.
+	tests := []struct {
+		name string
+		ext  []*pb.ComplexExtension
+	}{
+		{
+			"two fields",
+			[]*pb.ComplexExtension{
+				{First: proto.Int32(7)},
+				{Second: proto.Int32(11)},
+			},
+		},
+		{
+			"repeated field",
+			[]*pb.ComplexExtension{
+				{Third: []int32{1000}},
+				{Third: []int32{2000}},
+			},
+		},
+		{
+			"two fields and repeated field",
+			[]*pb.ComplexExtension{
+				{Third: []int32{1000}},
+				{First: proto.Int32(9)},
+				{Second: proto.Int32(21)},
+				{Third: []int32{2000}},
+			},
+		},
+	}
+	for _, test := range tests {
+		var buf bytes.Buffer
+		var want pb.ComplexExtension
+
+		// Generate a serialized representation of a repeated extension
+		// by catenating bytes together.
+		for i, e := range test.ext {
+			// Merge to create the wanted proto.
+			proto.Merge(&want, e)
+
+			// serialize the message
+			msg := new(pb.OtherMessage)
+			err := proto.SetExtension(msg, pb.E_Complex, e)
+			if err != nil {
+				t.Fatalf("[%s] Error setting extension %d: %v", test.name, i, err)
+			}
+			b, err := proto.Marshal(msg)
+			if err != nil {
+				t.Fatalf("[%s] Error marshaling message %d: %v", test.name, i, err)
+			}
+			buf.Write(b)
+		}
+
+		// Unmarshal and read the merged proto.
+		msg2 := new(pb.OtherMessage)
+		err := proto.Unmarshal(buf.Bytes(), msg2)
+		if err != nil {
+			t.Fatalf("[%s] Error unmarshaling message: %v", test.name, err)
+		}
+		e, err := proto.GetExtension(msg2, pb.E_Complex)
+		if err != nil {
+			t.Fatalf("[%s] Error getting extension: %v", test.name, err)
+		}
+		ext := e.(*pb.ComplexExtension)
+		if ext == nil {
+			t.Fatalf("[%s] Invalid extension", test.name)
+		}
+		if !reflect.DeepEqual(*ext, want) {
+			t.Errorf("[%s] Wrong value for ComplexExtension: got: %v want: %v\n", test.name, ext, want)
+		}
+	}
+}
+
+func TestClearAllExtensions(t *testing.T) {
+	// unregistered extension
+	desc := &proto.ExtensionDesc{
+		ExtendedType:  (*pb.MyMessage)(nil),
+		ExtensionType: (*bool)(nil),
+		Field:         101010100,
+		Name:          "emptyextension",
+		Tag:           "varint,0,opt",
+	}
+	m := &pb.MyMessage{}
+	if proto.HasExtension(m, desc) {
+		t.Errorf("proto.HasExtension(%s): got true, want false", proto.MarshalTextString(m))
+	}
+	if err := proto.SetExtension(m, desc, proto.Bool(true)); err != nil {
+		t.Errorf("proto.SetExtension(m, desc, true): got error %q, want nil", err)
+	}
+	if !proto.HasExtension(m, desc) {
+		t.Errorf("proto.HasExtension(%s): got false, want true", proto.MarshalTextString(m))
+	}
+	proto.ClearAllExtensions(m)
+	if proto.HasExtension(m, desc) {
+		t.Errorf("proto.HasExtension(%s): got true, want false", proto.MarshalTextString(m))
+	}
+}
+
+func TestMarshalRace(t *testing.T) {
+	// unregistered extension
+	desc := &proto.ExtensionDesc{
+		ExtendedType:  (*pb.MyMessage)(nil),
+		ExtensionType: (*bool)(nil),
+		Field:         101010100,
+		Name:          "emptyextension",
+		Tag:           "varint,0,opt",
+	}
+
+	m := &pb.MyMessage{Count: proto.Int32(4)}
+	if err := proto.SetExtension(m, desc, proto.Bool(true)); err != nil {
+		t.Errorf("proto.SetExtension(m, desc, true): got error %q, want nil", err)
+	}
+
+	errChan := make(chan error, 3)
+	for n := 3; n > 0; n-- {
+		go func() {
+			_, err := proto.Marshal(m)
+			errChan <- err
+		}()
+	}
+	for i := 0; i < 3; i++ {
+		err := <-errChan
+		if err != nil {
+			t.Fatal(err)
+		}
+	}
+}

+ 5 - 1
vendor/github.com/gogo/protobuf/proto/lib.go

@@ -308,7 +308,7 @@ func GetStats() Stats { return stats }
 // temporary Buffer and are fine for most applications.
 // temporary Buffer and are fine for most applications.
 type Buffer struct {
 type Buffer struct {
 	buf   []byte // encode/decode byte stream
 	buf   []byte // encode/decode byte stream
-	index int    // write point
+	index int    // read point
 
 
 	// pools of basic types to amortize allocation.
 	// pools of basic types to amortize allocation.
 	bools   []bool
 	bools   []bool
@@ -889,6 +889,10 @@ func isProto3Zero(v reflect.Value) bool {
 	return false
 	return false
 }
 }
 
 
+// ProtoPackageIsVersion2 is referenced from generated protocol buffer files
+// to assert that that code is compatible with this version of the proto package.
+const GoGoProtoPackageIsVersion2 = true
+
 // ProtoPackageIsVersion1 is referenced from generated protocol buffer files
 // ProtoPackageIsVersion1 is referenced from generated protocol buffer files
 // to assert that that code is compatible with this version of the proto package.
 // to assert that that code is compatible with this version of the proto package.
 const GoGoProtoPackageIsVersion1 = true
 const GoGoProtoPackageIsVersion1 = true

+ 4 - 2
vendor/github.com/gogo/protobuf/proto/lib_gogo.go

@@ -1,5 +1,7 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2013, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
 //
 //
 // Redistribution and use in source and binary forms, with or without
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // modification, are permitted provided that the following conditions are

+ 46 - 0
vendor/github.com/gogo/protobuf/proto/map_test.go

@@ -0,0 +1,46 @@
+package proto_test
+
+import (
+	"fmt"
+	"testing"
+
+	"github.com/gogo/protobuf/proto"
+	ppb "github.com/gogo/protobuf/proto/proto3_proto"
+)
+
+func marshalled() []byte {
+	m := &ppb.IntMaps{}
+	for i := 0; i < 1000; i++ {
+		m.Maps = append(m.Maps, &ppb.IntMap{
+			Rtt: map[int32]int32{1: 2},
+		})
+	}
+	b, err := proto.Marshal(m)
+	if err != nil {
+		panic(fmt.Sprintf("Can't marshal %+v: %v", m, err))
+	}
+	return b
+}
+
+func BenchmarkConcurrentMapUnmarshal(b *testing.B) {
+	in := marshalled()
+	b.RunParallel(func(pb *testing.PB) {
+		for pb.Next() {
+			var out ppb.IntMaps
+			if err := proto.Unmarshal(in, &out); err != nil {
+				b.Errorf("Can't unmarshal ppb.IntMaps: %v", err)
+			}
+		}
+	})
+}
+
+func BenchmarkSequentialMapUnmarshal(b *testing.B) {
+	in := marshalled()
+	b.ResetTimer()
+	for i := 0; i < b.N; i++ {
+		var out ppb.IntMaps
+		if err := proto.Unmarshal(in, &out); err != nil {
+			b.Errorf("Can't unmarshal ppb.IntMaps: %v", err)
+		}
+	}
+}

+ 37 - 6
vendor/github.com/gogo/protobuf/proto/message_set.go

@@ -149,9 +149,21 @@ func skipVarint(buf []byte) []byte {
 
 
 // MarshalMessageSet encodes the extension map represented by m in the message set wire format.
 // MarshalMessageSet encodes the extension map represented by m in the message set wire format.
 // It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option.
 // It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option.
-func MarshalMessageSet(m map[int32]Extension) ([]byte, error) {
-	if err := encodeExtensionMap(m); err != nil {
-		return nil, err
+func MarshalMessageSet(exts interface{}) ([]byte, error) {
+	var m map[int32]Extension
+	switch exts := exts.(type) {
+	case *XXX_InternalExtensions:
+		if err := encodeExtensions(exts); err != nil {
+			return nil, err
+		}
+		m, _ = exts.extensionsRead()
+	case map[int32]Extension:
+		if err := encodeExtensionsMap(exts); err != nil {
+			return nil, err
+		}
+		m = exts
+	default:
+		return nil, errors.New("proto: not an extension map")
 	}
 	}
 
 
 	// Sort extension IDs to provide a deterministic encoding.
 	// Sort extension IDs to provide a deterministic encoding.
@@ -178,7 +190,17 @@ func MarshalMessageSet(m map[int32]Extension) ([]byte, error) {
 
 
 // UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format.
 // UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format.
 // It is called by generated Unmarshal methods on protocol buffer messages with the message_set_wire_format option.
 // It is called by generated Unmarshal methods on protocol buffer messages with the message_set_wire_format option.
-func UnmarshalMessageSet(buf []byte, m map[int32]Extension) error {
+func UnmarshalMessageSet(buf []byte, exts interface{}) error {
+	var m map[int32]Extension
+	switch exts := exts.(type) {
+	case *XXX_InternalExtensions:
+		m = exts.extensionsWrite()
+	case map[int32]Extension:
+		m = exts
+	default:
+		return errors.New("proto: not an extension map")
+	}
+
 	ms := new(messageSet)
 	ms := new(messageSet)
 	if err := Unmarshal(buf, ms); err != nil {
 	if err := Unmarshal(buf, ms); err != nil {
 		return err
 		return err
@@ -209,7 +231,16 @@ func UnmarshalMessageSet(buf []byte, m map[int32]Extension) error {
 
 
 // MarshalMessageSetJSON encodes the extension map represented by m in JSON format.
 // MarshalMessageSetJSON encodes the extension map represented by m in JSON format.
 // It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
 // It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
-func MarshalMessageSetJSON(m map[int32]Extension) ([]byte, error) {
+func MarshalMessageSetJSON(exts interface{}) ([]byte, error) {
+	var m map[int32]Extension
+	switch exts := exts.(type) {
+	case *XXX_InternalExtensions:
+		m, _ = exts.extensionsRead()
+	case map[int32]Extension:
+		m = exts
+	default:
+		return nil, errors.New("proto: not an extension map")
+	}
 	var b bytes.Buffer
 	var b bytes.Buffer
 	b.WriteByte('{')
 	b.WriteByte('{')
 
 
@@ -252,7 +283,7 @@ func MarshalMessageSetJSON(m map[int32]Extension) ([]byte, error) {
 
 
 // UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format.
 // UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format.
 // It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
 // It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
-func UnmarshalMessageSetJSON(buf []byte, m map[int32]Extension) error {
+func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error {
 	// Common-case fast path.
 	// Common-case fast path.
 	if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) {
 	if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) {
 		return nil
 		return nil

+ 66 - 0
vendor/github.com/gogo/protobuf/proto/message_set_test.go

@@ -0,0 +1,66 @@
+// Go support for Protocol Buffers - Google's data interchange format
+//
+// Copyright 2014 The Go Authors.  All rights reserved.
+// https://github.com/golang/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package proto
+
+import (
+	"bytes"
+	"testing"
+)
+
+func TestUnmarshalMessageSetWithDuplicate(t *testing.T) {
+	// Check that a repeated message set entry will be concatenated.
+	in := &messageSet{
+		Item: []*_MessageSet_Item{
+			{TypeId: Int32(12345), Message: []byte("hoo")},
+			{TypeId: Int32(12345), Message: []byte("hah")},
+		},
+	}
+	b, err := Marshal(in)
+	if err != nil {
+		t.Fatalf("Marshal: %v", err)
+	}
+	t.Logf("Marshaled bytes: %q", b)
+
+	var extensions XXX_InternalExtensions
+	if err := UnmarshalMessageSet(b, &extensions); err != nil {
+		t.Fatalf("UnmarshalMessageSet: %v", err)
+	}
+	ext, ok := extensions.p.extensionMap[12345]
+	if !ok {
+		t.Fatalf("Didn't retrieve extension 12345; map is %v", extensions.p.extensionMap)
+	}
+	// Skip wire type/field number and length varints.
+	got := skipVarint(skipVarint(ext.enc))
+	if want := []byte("hoohah"); !bytes.Equal(got, want) {
+		t.Errorf("Combined extension is %q, want %q", got, want)
+	}
+}

+ 6 - 1
vendor/github.com/gogo/protobuf/proto/pointer_reflect.go

@@ -29,7 +29,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-// +build appengine
+// +build appengine js
 
 
 // This file contains an implementation of proto field accesses using package reflect.
 // This file contains an implementation of proto field accesses using package reflect.
 // It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can
 // It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can
@@ -139,6 +139,11 @@ func structPointer_StringSlice(p structPointer, f field) *[]string {
 	return structPointer_ifield(p, f).(*[]string)
 	return structPointer_ifield(p, f).(*[]string)
 }
 }
 
 
+// Extensions returns the address of an extension map field in the struct.
+func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions {
+	return structPointer_ifield(p, f).(*XXX_InternalExtensions)
+}
+
 // ExtMap returns the address of an extension map field in the struct.
 // ExtMap returns the address of an extension map field in the struct.
 func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension {
 func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension {
 	return structPointer_ifield(p, f).(*map[int32]Extension)
 	return structPointer_ifield(p, f).(*map[int32]Extension)

+ 85 - 0
vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go

@@ -0,0 +1,85 @@
+// Protocol Buffers for Go with Gadgets
+//
+// Copyright (c) 2016, The GoGo Authors. All rights reserved.
+// http://github.com/gogo/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// +build appengine js
+
+package proto
+
+import (
+	"reflect"
+)
+
+func structPointer_FieldPointer(p structPointer, f field) structPointer {
+	panic("not implemented")
+}
+
+func appendStructPointer(base structPointer, f field, typ reflect.Type) structPointer {
+	panic("not implemented")
+}
+
+func structPointer_InterfaceAt(p structPointer, f field, t reflect.Type) interface{} {
+	panic("not implemented")
+}
+
+func structPointer_InterfaceRef(p structPointer, f field, t reflect.Type) interface{} {
+	panic("not implemented")
+}
+
+func structPointer_GetRefStructPointer(p structPointer, f field) structPointer {
+	panic("not implemented")
+}
+
+func structPointer_Add(p structPointer, size field) structPointer {
+	panic("not implemented")
+}
+
+func structPointer_Len(p structPointer, f field) int {
+	panic("not implemented")
+}
+
+func structPointer_GetSliceHeader(p structPointer, f field) *reflect.SliceHeader {
+	panic("not implemented")
+}
+
+func structPointer_Copy(oldptr structPointer, newptr structPointer, size int) {
+	panic("not implemented")
+}
+
+func structPointer_StructRefSlice(p structPointer, f field, size uintptr) *structRefSlice {
+	panic("not implemented")
+}
+
+type structRefSlice struct{}
+
+func (v *structRefSlice) Len() int {
+	panic("not implemented")
+}
+
+func (v *structRefSlice) Index(i int) structPointer {
+	panic("not implemented")
+}

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.