Просмотр исходного кода

goprotobuf: Generate getters.

R=r
CC=golang-dev
http://codereview.appspot.com/6369043
David Symonds 13 лет назад
Родитель
Сommit
8bb32ca4b9

+ 669 - 152
protoc-gen-go/descriptor/descriptor.pb.go

@@ -6,31 +6,31 @@ package google_protobuf
 import proto "code.google.com/p/goprotobuf/proto"
 import "math"
 
-// Reference proto, math & os imports to suppress error if they are not otherwise used.
+// Reference proto and math imports to suppress error if they are not otherwise used.
 var _ = proto.GetString
 var _ = math.Inf
 
 type FieldDescriptorProto_Type int32
 
 const (
-	FieldDescriptorProto_TYPE_DOUBLE   = 1
-	FieldDescriptorProto_TYPE_FLOAT    = 2
-	FieldDescriptorProto_TYPE_INT64    = 3
-	FieldDescriptorProto_TYPE_UINT64   = 4
-	FieldDescriptorProto_TYPE_INT32    = 5
-	FieldDescriptorProto_TYPE_FIXED64  = 6
-	FieldDescriptorProto_TYPE_FIXED32  = 7
-	FieldDescriptorProto_TYPE_BOOL     = 8
-	FieldDescriptorProto_TYPE_STRING   = 9
-	FieldDescriptorProto_TYPE_GROUP    = 10
-	FieldDescriptorProto_TYPE_MESSAGE  = 11
-	FieldDescriptorProto_TYPE_BYTES    = 12
-	FieldDescriptorProto_TYPE_UINT32   = 13
-	FieldDescriptorProto_TYPE_ENUM     = 14
-	FieldDescriptorProto_TYPE_SFIXED32 = 15
-	FieldDescriptorProto_TYPE_SFIXED64 = 16
-	FieldDescriptorProto_TYPE_SINT32   = 17
-	FieldDescriptorProto_TYPE_SINT64   = 18
+	FieldDescriptorProto_TYPE_DOUBLE   FieldDescriptorProto_Type = 1
+	FieldDescriptorProto_TYPE_FLOAT    FieldDescriptorProto_Type = 2
+	FieldDescriptorProto_TYPE_INT64    FieldDescriptorProto_Type = 3
+	FieldDescriptorProto_TYPE_UINT64   FieldDescriptorProto_Type = 4
+	FieldDescriptorProto_TYPE_INT32    FieldDescriptorProto_Type = 5
+	FieldDescriptorProto_TYPE_FIXED64  FieldDescriptorProto_Type = 6
+	FieldDescriptorProto_TYPE_FIXED32  FieldDescriptorProto_Type = 7
+	FieldDescriptorProto_TYPE_BOOL     FieldDescriptorProto_Type = 8
+	FieldDescriptorProto_TYPE_STRING   FieldDescriptorProto_Type = 9
+	FieldDescriptorProto_TYPE_GROUP    FieldDescriptorProto_Type = 10
+	FieldDescriptorProto_TYPE_MESSAGE  FieldDescriptorProto_Type = 11
+	FieldDescriptorProto_TYPE_BYTES    FieldDescriptorProto_Type = 12
+	FieldDescriptorProto_TYPE_UINT32   FieldDescriptorProto_Type = 13
+	FieldDescriptorProto_TYPE_ENUM     FieldDescriptorProto_Type = 14
+	FieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15
+	FieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16
+	FieldDescriptorProto_TYPE_SINT32   FieldDescriptorProto_Type = 17
+	FieldDescriptorProto_TYPE_SINT64   FieldDescriptorProto_Type = 18
 )
 
 var FieldDescriptorProto_Type_name = map[int32]string{
@@ -74,10 +74,16 @@ var FieldDescriptorProto_Type_value = map[string]int32{
 	"TYPE_SINT64":   18,
 }
 
-func NewFieldDescriptorProto_Type(x int32) *FieldDescriptorProto_Type {
+// NewFieldDescriptorProto_Type is deprecated. Use x.Enum() instead.
+func NewFieldDescriptorProto_Type(x FieldDescriptorProto_Type) *FieldDescriptorProto_Type {
 	e := FieldDescriptorProto_Type(x)
 	return &e
 }
+func (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type {
+	p := new(FieldDescriptorProto_Type)
+	*p = x
+	return p
+}
 func (x FieldDescriptorProto_Type) String() string {
 	return proto.EnumName(FieldDescriptorProto_Type_name, int32(x))
 }
@@ -85,9 +91,9 @@ func (x FieldDescriptorProto_Type) String() string {
 type FieldDescriptorProto_Label int32
 
 const (
-	FieldDescriptorProto_LABEL_OPTIONAL = 1
-	FieldDescriptorProto_LABEL_REQUIRED = 2
-	FieldDescriptorProto_LABEL_REPEATED = 3
+	FieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1
+	FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2
+	FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3
 )
 
 var FieldDescriptorProto_Label_name = map[int32]string{
@@ -101,10 +107,16 @@ var FieldDescriptorProto_Label_value = map[string]int32{
 	"LABEL_REPEATED": 3,
 }
 
-func NewFieldDescriptorProto_Label(x int32) *FieldDescriptorProto_Label {
+// NewFieldDescriptorProto_Label is deprecated. Use x.Enum() instead.
+func NewFieldDescriptorProto_Label(x FieldDescriptorProto_Label) *FieldDescriptorProto_Label {
 	e := FieldDescriptorProto_Label(x)
 	return &e
 }
+func (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label {
+	p := new(FieldDescriptorProto_Label)
+	*p = x
+	return p
+}
 func (x FieldDescriptorProto_Label) String() string {
 	return proto.EnumName(FieldDescriptorProto_Label_name, int32(x))
 }
@@ -112,9 +124,9 @@ func (x FieldDescriptorProto_Label) String() string {
 type FileOptions_OptimizeMode int32
 
 const (
-	FileOptions_SPEED        = 1
-	FileOptions_CODE_SIZE    = 2
-	FileOptions_LITE_RUNTIME = 3
+	FileOptions_SPEED        FileOptions_OptimizeMode = 1
+	FileOptions_CODE_SIZE    FileOptions_OptimizeMode = 2
+	FileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3
 )
 
 var FileOptions_OptimizeMode_name = map[int32]string{
@@ -128,10 +140,16 @@ var FileOptions_OptimizeMode_value = map[string]int32{
 	"LITE_RUNTIME": 3,
 }
 
-func NewFileOptions_OptimizeMode(x int32) *FileOptions_OptimizeMode {
+// NewFileOptions_OptimizeMode is deprecated. Use x.Enum() instead.
+func NewFileOptions_OptimizeMode(x FileOptions_OptimizeMode) *FileOptions_OptimizeMode {
 	e := FileOptions_OptimizeMode(x)
 	return &e
 }
+func (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode {
+	p := new(FileOptions_OptimizeMode)
+	*p = x
+	return p
+}
 func (x FileOptions_OptimizeMode) String() string {
 	return proto.EnumName(FileOptions_OptimizeMode_name, int32(x))
 }
@@ -139,9 +157,9 @@ func (x FileOptions_OptimizeMode) String() string {
 type FieldOptions_CType int32
 
 const (
-	FieldOptions_STRING       = 0
-	FieldOptions_CORD         = 1
-	FieldOptions_STRING_PIECE = 2
+	FieldOptions_STRING       FieldOptions_CType = 0
+	FieldOptions_CORD         FieldOptions_CType = 1
+	FieldOptions_STRING_PIECE FieldOptions_CType = 2
 )
 
 var FieldOptions_CType_name = map[int32]string{
@@ -155,17 +173,53 @@ var FieldOptions_CType_value = map[string]int32{
 	"STRING_PIECE": 2,
 }
 
-func NewFieldOptions_CType(x int32) *FieldOptions_CType {
+// NewFieldOptions_CType is deprecated. Use x.Enum() instead.
+func NewFieldOptions_CType(x FieldOptions_CType) *FieldOptions_CType {
 	e := FieldOptions_CType(x)
 	return &e
 }
+func (x FieldOptions_CType) Enum() *FieldOptions_CType {
+	p := new(FieldOptions_CType)
+	*p = x
+	return p
+}
 func (x FieldOptions_CType) String() string {
 	return proto.EnumName(FieldOptions_CType_name, int32(x))
 }
 
+type StreamOptions_TokenUnit int32
+
+const (
+	StreamOptions_MESSAGE StreamOptions_TokenUnit = 0
+	StreamOptions_BYTE    StreamOptions_TokenUnit = 1
+)
+
+var StreamOptions_TokenUnit_name = map[int32]string{
+	0: "MESSAGE",
+	1: "BYTE",
+}
+var StreamOptions_TokenUnit_value = map[string]int32{
+	"MESSAGE": 0,
+	"BYTE":    1,
+}
+
+// NewStreamOptions_TokenUnit is deprecated. Use x.Enum() instead.
+func NewStreamOptions_TokenUnit(x StreamOptions_TokenUnit) *StreamOptions_TokenUnit {
+	e := StreamOptions_TokenUnit(x)
+	return &e
+}
+func (x StreamOptions_TokenUnit) Enum() *StreamOptions_TokenUnit {
+	p := new(StreamOptions_TokenUnit)
+	*p = x
+	return p
+}
+func (x StreamOptions_TokenUnit) String() string {
+	return proto.EnumName(StreamOptions_TokenUnit_name, int32(x))
+}
+
 type FileDescriptorSet struct {
-	File             []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file"`
-	XXX_unrecognized []byte
+	File             []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"`
+	XXX_unrecognized []byte                 `json:"-"`
 }
 
 func (this *FileDescriptorSet) Reset()         { *this = FileDescriptorSet{} }
@@ -173,120 +227,353 @@ func (this *FileDescriptorSet) String() string { return proto.CompactTextString(
 func (*FileDescriptorSet) ProtoMessage()       {}
 
 type FileDescriptorProto struct {
-	Name             *string                   `protobuf:"bytes,1,opt,name=name"`
-	Package          *string                   `protobuf:"bytes,2,opt,name=package"`
-	Dependency       []string                  `protobuf:"bytes,3,rep,name=dependency"`
-	PublicDependency []int32                   `protobuf:"varint,10,rep,name=public_dependency"`
+	Name             *string                   `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	Package          *string                   `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"`
+	Dependency       []string                  `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"`
+	PublicDependency []int32                   `protobuf:"varint,10,rep,name=public_dependency" json:"public_dependency,omitempty"`
 	WeakDependency   []int32                   `protobuf:"varint,11,rep,name=weak_dependency" json:"weak_dependency,omitempty"`
-	MessageType      []*DescriptorProto        `protobuf:"bytes,4,rep,name=message_type"`
-	EnumType         []*EnumDescriptorProto    `protobuf:"bytes,5,rep,name=enum_type"`
-	Service          []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service"`
-	Extension        []*FieldDescriptorProto   `protobuf:"bytes,7,rep,name=extension"`
-	Options          *FileOptions              `protobuf:"bytes,8,opt,name=options"`
-	XXX_unrecognized []byte
+	MessageType      []*DescriptorProto        `protobuf:"bytes,4,rep,name=message_type" json:"message_type,omitempty"`
+	EnumType         []*EnumDescriptorProto    `protobuf:"bytes,5,rep,name=enum_type" json:"enum_type,omitempty"`
+	Service          []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service" json:"service,omitempty"`
+	Extension        []*FieldDescriptorProto   `protobuf:"bytes,7,rep,name=extension" json:"extension,omitempty"`
+	Options          *FileOptions              `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"`
+	SourceCodeInfo   *SourceCodeInfo           `protobuf:"bytes,9,opt,name=source_code_info" json:"source_code_info,omitempty"`
+	XXX_unrecognized []byte                    `json:"-"`
 }
 
 func (this *FileDescriptorProto) Reset()         { *this = FileDescriptorProto{} }
 func (this *FileDescriptorProto) String() string { return proto.CompactTextString(this) }
 func (*FileDescriptorProto) ProtoMessage()       {}
 
+func (this *FileDescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *FileDescriptorProto) GetPackage() string {
+	if this != nil && this.Package != nil {
+		return *this.Package
+	}
+	return ""
+}
+
+func (this *FileDescriptorProto) GetOptions() *FileOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
+
+func (this *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo {
+	if this != nil {
+		return this.SourceCodeInfo
+	}
+	return nil
+}
+
 type DescriptorProto struct {
-	Name             *string                           `protobuf:"bytes,1,opt,name=name"`
-	Field            []*FieldDescriptorProto           `protobuf:"bytes,2,rep,name=field"`
-	Extension        []*FieldDescriptorProto           `protobuf:"bytes,6,rep,name=extension"`
-	NestedType       []*DescriptorProto                `protobuf:"bytes,3,rep,name=nested_type"`
-	EnumType         []*EnumDescriptorProto            `protobuf:"bytes,4,rep,name=enum_type"`
-	ExtensionRange   []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range"`
-	Options          *MessageOptions                   `protobuf:"bytes,7,opt,name=options"`
-	XXX_unrecognized []byte
+	Name             *string                           `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	Field            []*FieldDescriptorProto           `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"`
+	Extension        []*FieldDescriptorProto           `protobuf:"bytes,6,rep,name=extension" json:"extension,omitempty"`
+	NestedType       []*DescriptorProto                `protobuf:"bytes,3,rep,name=nested_type" json:"nested_type,omitempty"`
+	EnumType         []*EnumDescriptorProto            `protobuf:"bytes,4,rep,name=enum_type" json:"enum_type,omitempty"`
+	ExtensionRange   []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range" json:"extension_range,omitempty"`
+	Options          *MessageOptions                   `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"`
+	XXX_unrecognized []byte                            `json:"-"`
 }
 
 func (this *DescriptorProto) Reset()         { *this = DescriptorProto{} }
 func (this *DescriptorProto) String() string { return proto.CompactTextString(this) }
 func (*DescriptorProto) ProtoMessage()       {}
 
+func (this *DescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *DescriptorProto) GetOptions() *MessageOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
+
 type DescriptorProto_ExtensionRange struct {
-	Start            *int32 `protobuf:"varint,1,opt,name=start"`
-	End              *int32 `protobuf:"varint,2,opt,name=end"`
-	XXX_unrecognized []byte
+	Start            *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"`
+	End              *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"`
+	XXX_unrecognized []byte `json:"-"`
 }
 
 func (this *DescriptorProto_ExtensionRange) Reset()         { *this = DescriptorProto_ExtensionRange{} }
 func (this *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(this) }
 func (*DescriptorProto_ExtensionRange) ProtoMessage()       {}
 
+func (this *DescriptorProto_ExtensionRange) GetStart() int32 {
+	if this != nil && this.Start != nil {
+		return *this.Start
+	}
+	return 0
+}
+
+func (this *DescriptorProto_ExtensionRange) GetEnd() int32 {
+	if this != nil && this.End != nil {
+		return *this.End
+	}
+	return 0
+}
+
 type FieldDescriptorProto struct {
-	Name             *string                     `protobuf:"bytes,1,opt,name=name"`
-	Number           *int32                      `protobuf:"varint,3,opt,name=number"`
-	Label            *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=google_protobuf.FieldDescriptorProto_Label"`
-	Type             *FieldDescriptorProto_Type  `protobuf:"varint,5,opt,name=type,enum=google_protobuf.FieldDescriptorProto_Type"`
-	TypeName         *string                     `protobuf:"bytes,6,opt,name=type_name"`
-	Extendee         *string                     `protobuf:"bytes,2,opt,name=extendee"`
-	DefaultValue     *string                     `protobuf:"bytes,7,opt,name=default_value"`
-	Options          *FieldOptions               `protobuf:"bytes,8,opt,name=options"`
-	XXX_unrecognized []byte
+	Name             *string                     `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	Number           *int32                      `protobuf:"varint,3,opt,name=number" json:"number,omitempty"`
+	Label            *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=proto2.FieldDescriptorProto_Label" json:"label,omitempty"`
+	Type             *FieldDescriptorProto_Type  `protobuf:"varint,5,opt,name=type,enum=proto2.FieldDescriptorProto_Type" json:"type,omitempty"`
+	TypeName         *string                     `protobuf:"bytes,6,opt,name=type_name" json:"type_name,omitempty"`
+	Extendee         *string                     `protobuf:"bytes,2,opt,name=extendee" json:"extendee,omitempty"`
+	DefaultValue     *string                     `protobuf:"bytes,7,opt,name=default_value" json:"default_value,omitempty"`
+	Options          *FieldOptions               `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"`
+	XXX_unrecognized []byte                      `json:"-"`
 }
 
 func (this *FieldDescriptorProto) Reset()         { *this = FieldDescriptorProto{} }
 func (this *FieldDescriptorProto) String() string { return proto.CompactTextString(this) }
 func (*FieldDescriptorProto) ProtoMessage()       {}
 
+func (this *FieldDescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *FieldDescriptorProto) GetNumber() int32 {
+	if this != nil && this.Number != nil {
+		return *this.Number
+	}
+	return 0
+}
+
+func (this *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label {
+	if this != nil && this.Label != nil {
+		return *this.Label
+	}
+	return 0
+}
+
+func (this *FieldDescriptorProto) GetType() FieldDescriptorProto_Type {
+	if this != nil && this.Type != nil {
+		return *this.Type
+	}
+	return 0
+}
+
+func (this *FieldDescriptorProto) GetTypeName() string {
+	if this != nil && this.TypeName != nil {
+		return *this.TypeName
+	}
+	return ""
+}
+
+func (this *FieldDescriptorProto) GetExtendee() string {
+	if this != nil && this.Extendee != nil {
+		return *this.Extendee
+	}
+	return ""
+}
+
+func (this *FieldDescriptorProto) GetDefaultValue() string {
+	if this != nil && this.DefaultValue != nil {
+		return *this.DefaultValue
+	}
+	return ""
+}
+
+func (this *FieldDescriptorProto) GetOptions() *FieldOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
+
 type EnumDescriptorProto struct {
-	Name             *string                     `protobuf:"bytes,1,opt,name=name"`
-	Value            []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value"`
-	Options          *EnumOptions                `protobuf:"bytes,3,opt,name=options"`
-	XXX_unrecognized []byte
+	Name             *string                     `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	Value            []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"`
+	Options          *EnumOptions                `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"`
+	XXX_unrecognized []byte                      `json:"-"`
 }
 
 func (this *EnumDescriptorProto) Reset()         { *this = EnumDescriptorProto{} }
 func (this *EnumDescriptorProto) String() string { return proto.CompactTextString(this) }
 func (*EnumDescriptorProto) ProtoMessage()       {}
 
+func (this *EnumDescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *EnumDescriptorProto) GetOptions() *EnumOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
+
 type EnumValueDescriptorProto struct {
-	Name             *string           `protobuf:"bytes,1,opt,name=name"`
-	Number           *int32            `protobuf:"varint,2,opt,name=number"`
-	Options          *EnumValueOptions `protobuf:"bytes,3,opt,name=options"`
-	XXX_unrecognized []byte
+	Name             *string           `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	Number           *int32            `protobuf:"varint,2,opt,name=number" json:"number,omitempty"`
+	Options          *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"`
+	XXX_unrecognized []byte            `json:"-"`
 }
 
 func (this *EnumValueDescriptorProto) Reset()         { *this = EnumValueDescriptorProto{} }
 func (this *EnumValueDescriptorProto) String() string { return proto.CompactTextString(this) }
 func (*EnumValueDescriptorProto) ProtoMessage()       {}
 
+func (this *EnumValueDescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *EnumValueDescriptorProto) GetNumber() int32 {
+	if this != nil && this.Number != nil {
+		return *this.Number
+	}
+	return 0
+}
+
+func (this *EnumValueDescriptorProto) GetOptions() *EnumValueOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
+
 type ServiceDescriptorProto struct {
-	Name             *string                  `protobuf:"bytes,1,opt,name=name"`
-	Method           []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method"`
-	Options          *ServiceOptions          `protobuf:"bytes,3,opt,name=options"`
-	XXX_unrecognized []byte
+	Name             *string                  `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	Method           []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"`
+	Stream           []*StreamDescriptorProto `protobuf:"bytes,4,rep,name=stream" json:"stream,omitempty"`
+	Options          *ServiceOptions          `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"`
+	XXX_unrecognized []byte                   `json:"-"`
 }
 
 func (this *ServiceDescriptorProto) Reset()         { *this = ServiceDescriptorProto{} }
 func (this *ServiceDescriptorProto) String() string { return proto.CompactTextString(this) }
 func (*ServiceDescriptorProto) ProtoMessage()       {}
 
+func (this *ServiceDescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *ServiceDescriptorProto) GetOptions() *ServiceOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
+
 type MethodDescriptorProto struct {
-	Name             *string        `protobuf:"bytes,1,opt,name=name"`
-	InputType        *string        `protobuf:"bytes,2,opt,name=input_type"`
-	OutputType       *string        `protobuf:"bytes,3,opt,name=output_type"`
-	Options          *MethodOptions `protobuf:"bytes,4,opt,name=options"`
-	XXX_unrecognized []byte
+	Name             *string        `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	InputType        *string        `protobuf:"bytes,2,opt,name=input_type" json:"input_type,omitempty"`
+	OutputType       *string        `protobuf:"bytes,3,opt,name=output_type" json:"output_type,omitempty"`
+	Options          *MethodOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"`
+	XXX_unrecognized []byte         `json:"-"`
 }
 
 func (this *MethodDescriptorProto) Reset()         { *this = MethodDescriptorProto{} }
 func (this *MethodDescriptorProto) String() string { return proto.CompactTextString(this) }
 func (*MethodDescriptorProto) ProtoMessage()       {}
 
+func (this *MethodDescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *MethodDescriptorProto) GetInputType() string {
+	if this != nil && this.InputType != nil {
+		return *this.InputType
+	}
+	return ""
+}
+
+func (this *MethodDescriptorProto) GetOutputType() string {
+	if this != nil && this.OutputType != nil {
+		return *this.OutputType
+	}
+	return ""
+}
+
+func (this *MethodDescriptorProto) GetOptions() *MethodOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
+
+type StreamDescriptorProto struct {
+	Name              *string        `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	ClientMessageType *string        `protobuf:"bytes,2,opt,name=client_message_type" json:"client_message_type,omitempty"`
+	ServerMessageType *string        `protobuf:"bytes,3,opt,name=server_message_type" json:"server_message_type,omitempty"`
+	Options           *StreamOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"`
+	XXX_unrecognized  []byte         `json:"-"`
+}
+
+func (this *StreamDescriptorProto) Reset()         { *this = StreamDescriptorProto{} }
+func (this *StreamDescriptorProto) String() string { return proto.CompactTextString(this) }
+func (*StreamDescriptorProto) ProtoMessage()       {}
+
+func (this *StreamDescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *StreamDescriptorProto) GetClientMessageType() string {
+	if this != nil && this.ClientMessageType != nil {
+		return *this.ClientMessageType
+	}
+	return ""
+}
+
+func (this *StreamDescriptorProto) GetServerMessageType() string {
+	if this != nil && this.ServerMessageType != nil {
+		return *this.ServerMessageType
+	}
+	return ""
+}
+
+func (this *StreamDescriptorProto) GetOptions() *StreamOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
+
 type FileOptions struct {
-	JavaPackage         *string                   `protobuf:"bytes,1,opt,name=java_package"`
-	JavaOuterClassname  *string                   `protobuf:"bytes,8,opt,name=java_outer_classname"`
-	JavaMultipleFiles   *bool                     `protobuf:"varint,10,opt,name=java_multiple_files,def=0"`
-	OptimizeFor         *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,enum=google_protobuf.FileOptions_OptimizeMode,def=1"`
-	CcGenericServices   *bool                     `protobuf:"varint,16,opt,name=cc_generic_services,def=1"`
-	JavaGenericServices *bool                     `protobuf:"varint,17,opt,name=java_generic_services,def=1"`
-	PyGenericServices   *bool                     `protobuf:"varint,18,opt,name=py_generic_services,def=1"`
-	UninterpretedOption []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option"`
-	XXX_extensions      map[int32][]byte
-	XXX_unrecognized    []byte
+	JavaPackage               *string                   `protobuf:"bytes,1,opt,name=java_package" json:"java_package,omitempty"`
+	JavaOuterClassname        *string                   `protobuf:"bytes,8,opt,name=java_outer_classname" json:"java_outer_classname,omitempty"`
+	JavaMultipleFiles         *bool                     `protobuf:"varint,10,opt,name=java_multiple_files,def=0" json:"java_multiple_files,omitempty"`
+	JavaGenerateEqualsAndHash *bool                     `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,def=0" json:"java_generate_equals_and_hash,omitempty"`
+	OptimizeFor               *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,enum=proto2.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"`
+	GoPackage                 *string                   `protobuf:"bytes,11,opt,name=go_package" json:"go_package,omitempty"`
+	CcGenericServices         *bool                     `protobuf:"varint,16,opt,name=cc_generic_services,def=0" json:"cc_generic_services,omitempty"`
+	JavaGenericServices       *bool                     `protobuf:"varint,17,opt,name=java_generic_services,def=0" json:"java_generic_services,omitempty"`
+	PyGenericServices         *bool                     `protobuf:"varint,18,opt,name=py_generic_services,def=0" json:"py_generic_services,omitempty"`
+	UninterpretedOption       []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions            map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized          []byte                    `json:"-"`
 }
 
 func (this *FileOptions) Reset()         { *this = FileOptions{} }
@@ -294,31 +581,95 @@ func (this *FileOptions) String() string { return proto.CompactTextString(this)
 func (*FileOptions) ProtoMessage()       {}
 
 var extRange_FileOptions = []proto.ExtensionRange{
-	proto.ExtensionRange{1000, 536870911},
+	{1000, 536870911},
 }
 
 func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_FileOptions
 }
-func (this *FileOptions) ExtensionMap() map[int32][]byte {
+func (this *FileOptions) ExtensionMap() map[int32]proto.Extension {
 	if this.XXX_extensions == nil {
-		this.XXX_extensions = make(map[int32][]byte)
+		this.XXX_extensions = make(map[int32]proto.Extension)
 	}
 	return this.XXX_extensions
 }
 
 const Default_FileOptions_JavaMultipleFiles bool = false
+const Default_FileOptions_JavaGenerateEqualsAndHash bool = false
 const Default_FileOptions_OptimizeFor FileOptions_OptimizeMode = FileOptions_SPEED
-const Default_FileOptions_CcGenericServices bool = true
-const Default_FileOptions_JavaGenericServices bool = true
-const Default_FileOptions_PyGenericServices bool = true
+const Default_FileOptions_CcGenericServices bool = false
+const Default_FileOptions_JavaGenericServices bool = false
+const Default_FileOptions_PyGenericServices bool = false
+
+func (this *FileOptions) GetJavaPackage() string {
+	if this != nil && this.JavaPackage != nil {
+		return *this.JavaPackage
+	}
+	return ""
+}
+
+func (this *FileOptions) GetJavaOuterClassname() string {
+	if this != nil && this.JavaOuterClassname != nil {
+		return *this.JavaOuterClassname
+	}
+	return ""
+}
+
+func (this *FileOptions) GetJavaMultipleFiles() bool {
+	if this != nil && this.JavaMultipleFiles != nil {
+		return *this.JavaMultipleFiles
+	}
+	return Default_FileOptions_JavaMultipleFiles
+}
+
+func (this *FileOptions) GetJavaGenerateEqualsAndHash() bool {
+	if this != nil && this.JavaGenerateEqualsAndHash != nil {
+		return *this.JavaGenerateEqualsAndHash
+	}
+	return Default_FileOptions_JavaGenerateEqualsAndHash
+}
+
+func (this *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode {
+	if this != nil && this.OptimizeFor != nil {
+		return *this.OptimizeFor
+	}
+	return Default_FileOptions_OptimizeFor
+}
+
+func (this *FileOptions) GetGoPackage() string {
+	if this != nil && this.GoPackage != nil {
+		return *this.GoPackage
+	}
+	return ""
+}
+
+func (this *FileOptions) GetCcGenericServices() bool {
+	if this != nil && this.CcGenericServices != nil {
+		return *this.CcGenericServices
+	}
+	return Default_FileOptions_CcGenericServices
+}
+
+func (this *FileOptions) GetJavaGenericServices() bool {
+	if this != nil && this.JavaGenericServices != nil {
+		return *this.JavaGenericServices
+	}
+	return Default_FileOptions_JavaGenericServices
+}
+
+func (this *FileOptions) GetPyGenericServices() bool {
+	if this != nil && this.PyGenericServices != nil {
+		return *this.PyGenericServices
+	}
+	return Default_FileOptions_PyGenericServices
+}
 
 type MessageOptions struct {
-	MessageSetWireFormat         *bool                  `protobuf:"varint,1,opt,name=message_set_wire_format,def=0"`
-	NoStandardDescriptorAccessor *bool                  `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,def=0"`
-	UninterpretedOption          []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
-	XXX_extensions               map[int32][]byte
-	XXX_unrecognized             []byte
+	MessageSetWireFormat         *bool                     `protobuf:"varint,1,opt,name=message_set_wire_format,def=0" json:"message_set_wire_format,omitempty"`
+	NoStandardDescriptorAccessor *bool                     `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,def=0" json:"no_standard_descriptor_accessor,omitempty"`
+	UninterpretedOption          []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions               map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized             []byte                    `json:"-"`
 }
 
 func (this *MessageOptions) Reset()         { *this = MessageOptions{} }
@@ -326,15 +677,15 @@ func (this *MessageOptions) String() string { return proto.CompactTextString(thi
 func (*MessageOptions) ProtoMessage()       {}
 
 var extRange_MessageOptions = []proto.ExtensionRange{
-	proto.ExtensionRange{1000, 536870911},
+	{1000, 536870911},
 }
 
 func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_MessageOptions
 }
-func (this *MessageOptions) ExtensionMap() map[int32][]byte {
+func (this *MessageOptions) ExtensionMap() map[int32]proto.Extension {
 	if this.XXX_extensions == nil {
-		this.XXX_extensions = make(map[int32][]byte)
+		this.XXX_extensions = make(map[int32]proto.Extension)
 	}
 	return this.XXX_extensions
 }
@@ -342,15 +693,30 @@ func (this *MessageOptions) ExtensionMap() map[int32][]byte {
 const Default_MessageOptions_MessageSetWireFormat bool = false
 const Default_MessageOptions_NoStandardDescriptorAccessor bool = false
 
+func (this *MessageOptions) GetMessageSetWireFormat() bool {
+	if this != nil && this.MessageSetWireFormat != nil {
+		return *this.MessageSetWireFormat
+	}
+	return Default_MessageOptions_MessageSetWireFormat
+}
+
+func (this *MessageOptions) GetNoStandardDescriptorAccessor() bool {
+	if this != nil && this.NoStandardDescriptorAccessor != nil {
+		return *this.NoStandardDescriptorAccessor
+	}
+	return Default_MessageOptions_NoStandardDescriptorAccessor
+}
+
 type FieldOptions struct {
-	Ctype               *FieldOptions_CType    `protobuf:"varint,1,opt,name=ctype,enum=google_protobuf.FieldOptions_CType,def=0"`
-	Packed              *bool                  `protobuf:"varint,2,opt,name=packed"`
-	Deprecated          *bool                  `protobuf:"varint,3,opt,name=deprecated,def=0"`
-	ExperimentalMapKey  *string                `protobuf:"bytes,9,opt,name=experimental_map_key"`
-	Weak                *bool                  `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"`
-	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
-	XXX_extensions      map[int32][]byte
-	XXX_unrecognized    []byte
+	Ctype               *FieldOptions_CType       `protobuf:"varint,1,opt,name=ctype,enum=proto2.FieldOptions_CType,def=0" json:"ctype,omitempty"`
+	Packed              *bool                     `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"`
+	Lazy                *bool                     `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"`
+	Deprecated          *bool                     `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"`
+	ExperimentalMapKey  *string                   `protobuf:"bytes,9,opt,name=experimental_map_key" json:"experimental_map_key,omitempty"`
+	Weak                *bool                     `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"`
+	UninterpretedOption []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions      map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized    []byte                    `json:"-"`
 }
 
 func (this *FieldOptions) Reset()         { *this = FieldOptions{} }
@@ -358,28 +724,71 @@ func (this *FieldOptions) String() string { return proto.CompactTextString(this)
 func (*FieldOptions) ProtoMessage()       {}
 
 var extRange_FieldOptions = []proto.ExtensionRange{
-	proto.ExtensionRange{1000, 536870911},
+	{1000, 536870911},
 }
 
 func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_FieldOptions
 }
-func (this *FieldOptions) ExtensionMap() map[int32][]byte {
+func (this *FieldOptions) ExtensionMap() map[int32]proto.Extension {
 	if this.XXX_extensions == nil {
-		this.XXX_extensions = make(map[int32][]byte)
+		this.XXX_extensions = make(map[int32]proto.Extension)
 	}
 	return this.XXX_extensions
 }
 
 const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING
+const Default_FieldOptions_Lazy bool = false
 const Default_FieldOptions_Deprecated bool = false
+const Default_FieldOptions_Weak bool = false
+
+func (this *FieldOptions) GetCtype() FieldOptions_CType {
+	if this != nil && this.Ctype != nil {
+		return *this.Ctype
+	}
+	return Default_FieldOptions_Ctype
+}
+
+func (this *FieldOptions) GetPacked() bool {
+	if this != nil && this.Packed != nil {
+		return *this.Packed
+	}
+	return false
+}
+
+func (this *FieldOptions) GetLazy() bool {
+	if this != nil && this.Lazy != nil {
+		return *this.Lazy
+	}
+	return Default_FieldOptions_Lazy
+}
+
+func (this *FieldOptions) GetDeprecated() bool {
+	if this != nil && this.Deprecated != nil {
+		return *this.Deprecated
+	}
+	return Default_FieldOptions_Deprecated
+}
+
+func (this *FieldOptions) GetExperimentalMapKey() string {
+	if this != nil && this.ExperimentalMapKey != nil {
+		return *this.ExperimentalMapKey
+	}
+	return ""
+}
+
+func (this *FieldOptions) GetWeak() bool {
+	if this != nil && this.Weak != nil {
+		return *this.Weak
+	}
+	return Default_FieldOptions_Weak
+}
 
 type EnumOptions struct {
-	Proto1Name          *string                `protobuf:"bytes,1,opt,name=proto1_name" json:"proto1_name,omitempty"`
-	AllowAlias          *bool                  `protobuf:"varint,2,opt,name=allow_alias,def=1" json:"allow_alias,omitempty"`
-	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
-	XXX_extensions      map[int32][]byte
-	XXX_unrecognized    []byte
+	AllowAlias          *bool                     `protobuf:"varint,2,opt,name=allow_alias,def=1" json:"allow_alias,omitempty"`
+	UninterpretedOption []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions      map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized    []byte                    `json:"-"`
 }
 
 func (this *EnumOptions) Reset()         { *this = EnumOptions{} }
@@ -387,25 +796,32 @@ func (this *EnumOptions) String() string { return proto.CompactTextString(this)
 func (*EnumOptions) ProtoMessage()       {}
 
 var extRange_EnumOptions = []proto.ExtensionRange{
-	proto.ExtensionRange{1000, 536870911},
+	{1000, 536870911},
 }
 
 func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_EnumOptions
 }
-func (this *EnumOptions) ExtensionMap() map[int32][]byte {
+func (this *EnumOptions) ExtensionMap() map[int32]proto.Extension {
 	if this.XXX_extensions == nil {
-		this.XXX_extensions = make(map[int32][]byte)
+		this.XXX_extensions = make(map[int32]proto.Extension)
 	}
 	return this.XXX_extensions
 }
 
 const Default_EnumOptions_AllowAlias bool = true
 
+func (this *EnumOptions) GetAllowAlias() bool {
+	if this != nil && this.AllowAlias != nil {
+		return *this.AllowAlias
+	}
+	return Default_EnumOptions_AllowAlias
+}
+
 type EnumValueOptions struct {
-	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
-	XXX_extensions      map[int32][]byte
-	XXX_unrecognized    []byte
+	UninterpretedOption []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions      map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized    []byte                    `json:"-"`
 }
 
 func (this *EnumValueOptions) Reset()         { *this = EnumValueOptions{} }
@@ -413,23 +829,23 @@ func (this *EnumValueOptions) String() string { return proto.CompactTextString(t
 func (*EnumValueOptions) ProtoMessage()       {}
 
 var extRange_EnumValueOptions = []proto.ExtensionRange{
-	proto.ExtensionRange{1000, 536870911},
+	{1000, 536870911},
 }
 
 func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_EnumValueOptions
 }
-func (this *EnumValueOptions) ExtensionMap() map[int32][]byte {
+func (this *EnumValueOptions) ExtensionMap() map[int32]proto.Extension {
 	if this.XXX_extensions == nil {
-		this.XXX_extensions = make(map[int32][]byte)
+		this.XXX_extensions = make(map[int32]proto.Extension)
 	}
 	return this.XXX_extensions
 }
 
 type ServiceOptions struct {
-	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
-	XXX_extensions      map[int32][]byte
-	XXX_unrecognized    []byte
+	UninterpretedOption []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions      map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized    []byte                    `json:"-"`
 }
 
 func (this *ServiceOptions) Reset()         { *this = ServiceOptions{} }
@@ -437,23 +853,23 @@ func (this *ServiceOptions) String() string { return proto.CompactTextString(thi
 func (*ServiceOptions) ProtoMessage()       {}
 
 var extRange_ServiceOptions = []proto.ExtensionRange{
-	proto.ExtensionRange{1000, 536870911},
+	{1000, 536870911},
 }
 
 func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_ServiceOptions
 }
-func (this *ServiceOptions) ExtensionMap() map[int32][]byte {
+func (this *ServiceOptions) ExtensionMap() map[int32]proto.Extension {
 	if this.XXX_extensions == nil {
-		this.XXX_extensions = make(map[int32][]byte)
+		this.XXX_extensions = make(map[int32]proto.Extension)
 	}
 	return this.XXX_extensions
 }
 
 type MethodOptions struct {
-	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
-	XXX_extensions      map[int32][]byte
-	XXX_unrecognized    []byte
+	UninterpretedOption []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions      map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized    []byte                    `json:"-"`
 }
 
 func (this *MethodOptions) Reset()         { *this = MethodOptions{} }
@@ -461,46 +877,147 @@ func (this *MethodOptions) String() string { return proto.CompactTextString(this
 func (*MethodOptions) ProtoMessage()       {}
 
 var extRange_MethodOptions = []proto.ExtensionRange{
-	proto.ExtensionRange{1000, 536870911},
+	{1000, 536870911},
 }
 
 func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_MethodOptions
 }
-func (this *MethodOptions) ExtensionMap() map[int32][]byte {
+func (this *MethodOptions) ExtensionMap() map[int32]proto.Extension {
+	if this.XXX_extensions == nil {
+		this.XXX_extensions = make(map[int32]proto.Extension)
+	}
+	return this.XXX_extensions
+}
+
+type StreamOptions struct {
+	UninterpretedOption []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions      map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized    []byte                    `json:"-"`
+}
+
+func (this *StreamOptions) Reset()         { *this = StreamOptions{} }
+func (this *StreamOptions) String() string { return proto.CompactTextString(this) }
+func (*StreamOptions) ProtoMessage()       {}
+
+var extRange_StreamOptions = []proto.ExtensionRange{
+	{1000, 536870911},
+}
+
+func (*StreamOptions) ExtensionRangeArray() []proto.ExtensionRange {
+	return extRange_StreamOptions
+}
+func (this *StreamOptions) ExtensionMap() map[int32]proto.Extension {
 	if this.XXX_extensions == nil {
-		this.XXX_extensions = make(map[int32][]byte)
+		this.XXX_extensions = make(map[int32]proto.Extension)
 	}
 	return this.XXX_extensions
 }
 
 type UninterpretedOption struct {
-	Name             []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name"`
-	IdentifierValue  *string                         `protobuf:"bytes,3,opt,name=identifier_value"`
-	PositiveIntValue *uint64                         `protobuf:"varint,4,opt,name=positive_int_value"`
-	NegativeIntValue *int64                          `protobuf:"varint,5,opt,name=negative_int_value"`
-	DoubleValue      *float64                        `protobuf:"fixed64,6,opt,name=double_value"`
-	StringValue      []byte                          `protobuf:"bytes,7,opt,name=string_value"`
-	XXX_unrecognized []byte
+	Name             []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"`
+	IdentifierValue  *string                         `protobuf:"bytes,3,opt,name=identifier_value" json:"identifier_value,omitempty"`
+	PositiveIntValue *uint64                         `protobuf:"varint,4,opt,name=positive_int_value" json:"positive_int_value,omitempty"`
+	NegativeIntValue *int64                          `protobuf:"varint,5,opt,name=negative_int_value" json:"negative_int_value,omitempty"`
+	DoubleValue      *float64                        `protobuf:"fixed64,6,opt,name=double_value" json:"double_value,omitempty"`
+	StringValue      []byte                          `protobuf:"bytes,7,opt,name=string_value" json:"string_value,omitempty"`
+	AggregateValue   *string                         `protobuf:"bytes,8,opt,name=aggregate_value" json:"aggregate_value,omitempty"`
+	XXX_unrecognized []byte                          `json:"-"`
 }
 
 func (this *UninterpretedOption) Reset()         { *this = UninterpretedOption{} }
 func (this *UninterpretedOption) String() string { return proto.CompactTextString(this) }
 func (*UninterpretedOption) ProtoMessage()       {}
 
+func (this *UninterpretedOption) GetIdentifierValue() string {
+	if this != nil && this.IdentifierValue != nil {
+		return *this.IdentifierValue
+	}
+	return ""
+}
+
+func (this *UninterpretedOption) GetPositiveIntValue() uint64 {
+	if this != nil && this.PositiveIntValue != nil {
+		return *this.PositiveIntValue
+	}
+	return 0
+}
+
+func (this *UninterpretedOption) GetNegativeIntValue() int64 {
+	if this != nil && this.NegativeIntValue != nil {
+		return *this.NegativeIntValue
+	}
+	return 0
+}
+
+func (this *UninterpretedOption) GetDoubleValue() float64 {
+	if this != nil && this.DoubleValue != nil {
+		return *this.DoubleValue
+	}
+	return 0
+}
+
+func (this *UninterpretedOption) GetStringValue() []byte {
+	if this != nil {
+		return this.StringValue
+	}
+	return nil
+}
+
+func (this *UninterpretedOption) GetAggregateValue() string {
+	if this != nil && this.AggregateValue != nil {
+		return *this.AggregateValue
+	}
+	return ""
+}
+
 type UninterpretedOption_NamePart struct {
-	NamePart         *string `protobuf:"bytes,1,req,name=name_part"`
-	IsExtension      *bool   `protobuf:"varint,2,req,name=is_extension"`
-	XXX_unrecognized []byte
+	NamePart         *string `protobuf:"bytes,1,req,name=name_part" json:"name_part,omitempty"`
+	IsExtension      *bool   `protobuf:"varint,2,req,name=is_extension" json:"is_extension,omitempty"`
+	XXX_unrecognized []byte  `json:"-"`
 }
 
 func (this *UninterpretedOption_NamePart) Reset()         { *this = UninterpretedOption_NamePart{} }
 func (this *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(this) }
 func (*UninterpretedOption_NamePart) ProtoMessage()       {}
 
+func (this *UninterpretedOption_NamePart) GetNamePart() string {
+	if this != nil && this.NamePart != nil {
+		return *this.NamePart
+	}
+	return ""
+}
+
+func (this *UninterpretedOption_NamePart) GetIsExtension() bool {
+	if this != nil && this.IsExtension != nil {
+		return *this.IsExtension
+	}
+	return false
+}
+
+type SourceCodeInfo struct {
+	Location         []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"`
+	XXX_unrecognized []byte                     `json:"-"`
+}
+
+func (this *SourceCodeInfo) Reset()         { *this = SourceCodeInfo{} }
+func (this *SourceCodeInfo) String() string { return proto.CompactTextString(this) }
+func (*SourceCodeInfo) ProtoMessage()       {}
+
+type SourceCodeInfo_Location struct {
+	Path             []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"`
+	Span             []int32 `protobuf:"varint,2,rep,packed,name=span" json:"span,omitempty"`
+	XXX_unrecognized []byte  `json:"-"`
+}
+
+func (this *SourceCodeInfo_Location) Reset()         { *this = SourceCodeInfo_Location{} }
+func (this *SourceCodeInfo_Location) String() string { return proto.CompactTextString(this) }
+func (*SourceCodeInfo_Location) ProtoMessage()       {}
+
 func init() {
 	proto.RegisterEnum("google_protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value)
 	proto.RegisterEnum("google_protobuf.FieldDescriptorProto_Label", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value)
 	proto.RegisterEnum("google_protobuf.FileOptions_OptimizeMode", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value)
 	proto.RegisterEnum("google_protobuf.FieldOptions_CType", FieldOptions_CType_name, FieldOptions_CType_value)
+	proto.RegisterEnum("google_protobuf.StreamOptions_TokenUnit", StreamOptions_TokenUnit_name, StreamOptions_TokenUnit_value)
 }

+ 687 - 152
protoc-gen-go/descriptor/descriptor.pb.golden

@@ -6,31 +6,31 @@ package google_protobuf
 import proto "code.google.com/p/goprotobuf/proto"
 import "math"
 
-// Reference proto, math & os imports to suppress error if they are not otherwise used.
+// Reference proto and math imports to suppress error if they are not otherwise used.
 var _ = proto.GetString
 var _ = math.Inf
 
 type FieldDescriptorProto_Type int32
 
 const (
-	FieldDescriptorProto_TYPE_DOUBLE   = 1
-	FieldDescriptorProto_TYPE_FLOAT    = 2
-	FieldDescriptorProto_TYPE_INT64    = 3
-	FieldDescriptorProto_TYPE_UINT64   = 4
-	FieldDescriptorProto_TYPE_INT32    = 5
-	FieldDescriptorProto_TYPE_FIXED64  = 6
-	FieldDescriptorProto_TYPE_FIXED32  = 7
-	FieldDescriptorProto_TYPE_BOOL     = 8
-	FieldDescriptorProto_TYPE_STRING   = 9
-	FieldDescriptorProto_TYPE_GROUP    = 10
-	FieldDescriptorProto_TYPE_MESSAGE  = 11
-	FieldDescriptorProto_TYPE_BYTES    = 12
-	FieldDescriptorProto_TYPE_UINT32   = 13
-	FieldDescriptorProto_TYPE_ENUM     = 14
-	FieldDescriptorProto_TYPE_SFIXED32 = 15
-	FieldDescriptorProto_TYPE_SFIXED64 = 16
-	FieldDescriptorProto_TYPE_SINT32   = 17
-	FieldDescriptorProto_TYPE_SINT64   = 18
+	FieldDescriptorProto_TYPE_DOUBLE   FieldDescriptorProto_Type = 1
+	FieldDescriptorProto_TYPE_FLOAT    FieldDescriptorProto_Type = 2
+	FieldDescriptorProto_TYPE_INT64    FieldDescriptorProto_Type = 3
+	FieldDescriptorProto_TYPE_UINT64   FieldDescriptorProto_Type = 4
+	FieldDescriptorProto_TYPE_INT32    FieldDescriptorProto_Type = 5
+	FieldDescriptorProto_TYPE_FIXED64  FieldDescriptorProto_Type = 6
+	FieldDescriptorProto_TYPE_FIXED32  FieldDescriptorProto_Type = 7
+	FieldDescriptorProto_TYPE_BOOL     FieldDescriptorProto_Type = 8
+	FieldDescriptorProto_TYPE_STRING   FieldDescriptorProto_Type = 9
+	FieldDescriptorProto_TYPE_GROUP    FieldDescriptorProto_Type = 10
+	FieldDescriptorProto_TYPE_MESSAGE  FieldDescriptorProto_Type = 11
+	FieldDescriptorProto_TYPE_BYTES    FieldDescriptorProto_Type = 12
+	FieldDescriptorProto_TYPE_UINT32   FieldDescriptorProto_Type = 13
+	FieldDescriptorProto_TYPE_ENUM     FieldDescriptorProto_Type = 14
+	FieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15
+	FieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16
+	FieldDescriptorProto_TYPE_SINT32   FieldDescriptorProto_Type = 17
+	FieldDescriptorProto_TYPE_SINT64   FieldDescriptorProto_Type = 18
 )
 
 var FieldDescriptorProto_Type_name = map[int32]string{
@@ -74,10 +74,16 @@ var FieldDescriptorProto_Type_value = map[string]int32{
 	"TYPE_SINT64":   18,
 }
 
-func NewFieldDescriptorProto_Type(x int32) *FieldDescriptorProto_Type {
+// NewFieldDescriptorProto_Type is deprecated. Use x.Enum() instead.
+func NewFieldDescriptorProto_Type(x FieldDescriptorProto_Type) *FieldDescriptorProto_Type {
 	e := FieldDescriptorProto_Type(x)
 	return &e
 }
+func (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type {
+	p := new(FieldDescriptorProto_Type)
+	*p = x
+	return p
+}
 func (x FieldDescriptorProto_Type) String() string {
 	return proto.EnumName(FieldDescriptorProto_Type_name, int32(x))
 }
@@ -85,9 +91,9 @@ func (x FieldDescriptorProto_Type) String() string {
 type FieldDescriptorProto_Label int32
 
 const (
-	FieldDescriptorProto_LABEL_OPTIONAL = 1
-	FieldDescriptorProto_LABEL_REQUIRED = 2
-	FieldDescriptorProto_LABEL_REPEATED = 3
+	FieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1
+	FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2
+	FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3
 )
 
 var FieldDescriptorProto_Label_name = map[int32]string{
@@ -101,10 +107,16 @@ var FieldDescriptorProto_Label_value = map[string]int32{
 	"LABEL_REPEATED": 3,
 }
 
-func NewFieldDescriptorProto_Label(x int32) *FieldDescriptorProto_Label {
+// NewFieldDescriptorProto_Label is deprecated. Use x.Enum() instead.
+func NewFieldDescriptorProto_Label(x FieldDescriptorProto_Label) *FieldDescriptorProto_Label {
 	e := FieldDescriptorProto_Label(x)
 	return &e
 }
+func (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label {
+	p := new(FieldDescriptorProto_Label)
+	*p = x
+	return p
+}
 func (x FieldDescriptorProto_Label) String() string {
 	return proto.EnumName(FieldDescriptorProto_Label_name, int32(x))
 }
@@ -112,9 +124,9 @@ func (x FieldDescriptorProto_Label) String() string {
 type FileOptions_OptimizeMode int32
 
 const (
-	FileOptions_SPEED        = 1
-	FileOptions_CODE_SIZE    = 2
-	FileOptions_LITE_RUNTIME = 3
+	FileOptions_SPEED        FileOptions_OptimizeMode = 1
+	FileOptions_CODE_SIZE    FileOptions_OptimizeMode = 2
+	FileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3
 )
 
 var FileOptions_OptimizeMode_name = map[int32]string{
@@ -128,10 +140,16 @@ var FileOptions_OptimizeMode_value = map[string]int32{
 	"LITE_RUNTIME": 3,
 }
 
-func NewFileOptions_OptimizeMode(x int32) *FileOptions_OptimizeMode {
+// NewFileOptions_OptimizeMode is deprecated. Use x.Enum() instead.
+func NewFileOptions_OptimizeMode(x FileOptions_OptimizeMode) *FileOptions_OptimizeMode {
 	e := FileOptions_OptimizeMode(x)
 	return &e
 }
+func (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode {
+	p := new(FileOptions_OptimizeMode)
+	*p = x
+	return p
+}
 func (x FileOptions_OptimizeMode) String() string {
 	return proto.EnumName(FileOptions_OptimizeMode_name, int32(x))
 }
@@ -139,9 +157,9 @@ func (x FileOptions_OptimizeMode) String() string {
 type FieldOptions_CType int32
 
 const (
-	FieldOptions_STRING       = 0
-	FieldOptions_CORD         = 1
-	FieldOptions_STRING_PIECE = 2
+	FieldOptions_STRING       FieldOptions_CType = 0
+	FieldOptions_CORD         FieldOptions_CType = 1
+	FieldOptions_STRING_PIECE FieldOptions_CType = 2
 )
 
 var FieldOptions_CType_name = map[int32]string{
@@ -155,175 +173,519 @@ var FieldOptions_CType_value = map[string]int32{
 	"STRING_PIECE": 2,
 }
 
-func NewFieldOptions_CType(x int32) *FieldOptions_CType {
+// NewFieldOptions_CType is deprecated. Use x.Enum() instead.
+func NewFieldOptions_CType(x FieldOptions_CType) *FieldOptions_CType {
 	e := FieldOptions_CType(x)
 	return &e
 }
+func (x FieldOptions_CType) Enum() *FieldOptions_CType {
+	p := new(FieldOptions_CType)
+	*p = x
+	return p
+}
 func (x FieldOptions_CType) String() string {
 	return proto.EnumName(FieldOptions_CType_name, int32(x))
 }
 
+type StreamOptions_TokenUnit int32
+
+const (
+	StreamOptions_MESSAGE StreamOptions_TokenUnit = 0
+	StreamOptions_BYTE    StreamOptions_TokenUnit = 1
+)
+
+var StreamOptions_TokenUnit_name = map[int32]string{
+	0: "MESSAGE",
+	1: "BYTE",
+}
+var StreamOptions_TokenUnit_value = map[string]int32{
+	"MESSAGE": 0,
+	"BYTE":    1,
+}
+
+// NewStreamOptions_TokenUnit is deprecated. Use x.Enum() instead.
+func NewStreamOptions_TokenUnit(x StreamOptions_TokenUnit) *StreamOptions_TokenUnit {
+	e := StreamOptions_TokenUnit(x)
+	return &e
+}
+func (x StreamOptions_TokenUnit) Enum() *StreamOptions_TokenUnit {
+	p := new(StreamOptions_TokenUnit)
+	*p = x
+	return p
+}
+func (x StreamOptions_TokenUnit) String() string {
+	return proto.EnumName(StreamOptions_TokenUnit_name, int32(x))
+}
+
 type FileDescriptorSet struct {
-	File             []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file"`
-	XXX_unrecognized []byte
+	File             []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"`
+	XXX_unrecognized []byte                 `json:"-"`
 }
 
 func (this *FileDescriptorSet) Reset()         { *this = FileDescriptorSet{} }
 func (this *FileDescriptorSet) String() string { return proto.CompactTextString(this) }
+func (*FileDescriptorSet) ProtoMessage()       {}
 
 type FileDescriptorProto struct {
-	Name             *string                   `protobuf:"bytes,1,opt,name=name"`
-	Package          *string                   `protobuf:"bytes,2,opt,name=package"`
-	Dependency       []string                  `protobuf:"bytes,3,rep,name=dependency"`
-	PublicDependency []int32                   `protobuf:"varint,10,rep,name=public_dependency"`
+	Name             *string                   `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	Package          *string                   `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"`
+	Dependency       []string                  `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"`
+	PublicDependency []int32                   `protobuf:"varint,10,rep,name=public_dependency" json:"public_dependency,omitempty"`
 	WeakDependency   []int32                   `protobuf:"varint,11,rep,name=weak_dependency" json:"weak_dependency,omitempty"`
-	MessageType      []*DescriptorProto        `protobuf:"bytes,4,rep,name=message_type"`
-	EnumType         []*EnumDescriptorProto    `protobuf:"bytes,5,rep,name=enum_type"`
-	Service          []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service"`
-	Extension        []*FieldDescriptorProto   `protobuf:"bytes,7,rep,name=extension"`
-	Options          *FileOptions              `protobuf:"bytes,8,opt,name=options"`
-	XXX_unrecognized []byte
+	MessageType      []*DescriptorProto        `protobuf:"bytes,4,rep,name=message_type" json:"message_type,omitempty"`
+	EnumType         []*EnumDescriptorProto    `protobuf:"bytes,5,rep,name=enum_type" json:"enum_type,omitempty"`
+	Service          []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service" json:"service,omitempty"`
+	Extension        []*FieldDescriptorProto   `protobuf:"bytes,7,rep,name=extension" json:"extension,omitempty"`
+	Options          *FileOptions              `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"`
+	SourceCodeInfo   *SourceCodeInfo           `protobuf:"bytes,9,opt,name=source_code_info" json:"source_code_info,omitempty"`
+	XXX_unrecognized []byte                    `json:"-"`
 }
 
 func (this *FileDescriptorProto) Reset()         { *this = FileDescriptorProto{} }
 func (this *FileDescriptorProto) String() string { return proto.CompactTextString(this) }
+func (*FileDescriptorProto) ProtoMessage()       {}
+
+func (this *FileDescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *FileDescriptorProto) GetPackage() string {
+	if this != nil && this.Package != nil {
+		return *this.Package
+	}
+	return ""
+}
+
+func (this *FileDescriptorProto) GetOptions() *FileOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
+
+func (this *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo {
+	if this != nil {
+		return this.SourceCodeInfo
+	}
+	return nil
+}
 
 type DescriptorProto struct {
-	Name             *string                           `protobuf:"bytes,1,opt,name=name"`
-	Field            []*FieldDescriptorProto           `protobuf:"bytes,2,rep,name=field"`
-	Extension        []*FieldDescriptorProto           `protobuf:"bytes,6,rep,name=extension"`
-	NestedType       []*DescriptorProto                `protobuf:"bytes,3,rep,name=nested_type"`
-	EnumType         []*EnumDescriptorProto            `protobuf:"bytes,4,rep,name=enum_type"`
-	ExtensionRange   []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range"`
-	Options          *MessageOptions                   `protobuf:"bytes,7,opt,name=options"`
-	XXX_unrecognized []byte
+	Name             *string                           `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	Field            []*FieldDescriptorProto           `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"`
+	Extension        []*FieldDescriptorProto           `protobuf:"bytes,6,rep,name=extension" json:"extension,omitempty"`
+	NestedType       []*DescriptorProto                `protobuf:"bytes,3,rep,name=nested_type" json:"nested_type,omitempty"`
+	EnumType         []*EnumDescriptorProto            `protobuf:"bytes,4,rep,name=enum_type" json:"enum_type,omitempty"`
+	ExtensionRange   []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range" json:"extension_range,omitempty"`
+	Options          *MessageOptions                   `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"`
+	XXX_unrecognized []byte                            `json:"-"`
 }
 
 func (this *DescriptorProto) Reset()         { *this = DescriptorProto{} }
 func (this *DescriptorProto) String() string { return proto.CompactTextString(this) }
+func (*DescriptorProto) ProtoMessage()       {}
+
+func (this *DescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *DescriptorProto) GetOptions() *MessageOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
 
 type DescriptorProto_ExtensionRange struct {
-	Start            *int32 `protobuf:"varint,1,opt,name=start"`
-	End              *int32 `protobuf:"varint,2,opt,name=end"`
-	XXX_unrecognized []byte
+	Start            *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"`
+	End              *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"`
+	XXX_unrecognized []byte `json:"-"`
 }
 
 func (this *DescriptorProto_ExtensionRange) Reset()         { *this = DescriptorProto_ExtensionRange{} }
 func (this *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(this) }
+func (*DescriptorProto_ExtensionRange) ProtoMessage()       {}
+
+func (this *DescriptorProto_ExtensionRange) GetStart() int32 {
+	if this != nil && this.Start != nil {
+		return *this.Start
+	}
+	return 0
+}
+
+func (this *DescriptorProto_ExtensionRange) GetEnd() int32 {
+	if this != nil && this.End != nil {
+		return *this.End
+	}
+	return 0
+}
 
 type FieldDescriptorProto struct {
-	Name             *string                     `protobuf:"bytes,1,opt,name=name"`
-	Number           *int32                      `protobuf:"varint,3,opt,name=number"`
-	Label            *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=google_protobuf.FieldDescriptorProto_Label"`
-	Type             *FieldDescriptorProto_Type  `protobuf:"varint,5,opt,name=type,enum=google_protobuf.FieldDescriptorProto_Type"`
-	TypeName         *string                     `protobuf:"bytes,6,opt,name=type_name"`
-	Extendee         *string                     `protobuf:"bytes,2,opt,name=extendee"`
-	DefaultValue     *string                     `protobuf:"bytes,7,opt,name=default_value"`
-	Options          *FieldOptions               `protobuf:"bytes,8,opt,name=options"`
-	XXX_unrecognized []byte
+	Name             *string                     `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	Number           *int32                      `protobuf:"varint,3,opt,name=number" json:"number,omitempty"`
+	Label            *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=proto2.FieldDescriptorProto_Label" json:"label,omitempty"`
+	Type             *FieldDescriptorProto_Type  `protobuf:"varint,5,opt,name=type,enum=proto2.FieldDescriptorProto_Type" json:"type,omitempty"`
+	TypeName         *string                     `protobuf:"bytes,6,opt,name=type_name" json:"type_name,omitempty"`
+	Extendee         *string                     `protobuf:"bytes,2,opt,name=extendee" json:"extendee,omitempty"`
+	DefaultValue     *string                     `protobuf:"bytes,7,opt,name=default_value" json:"default_value,omitempty"`
+	Options          *FieldOptions               `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"`
+	XXX_unrecognized []byte                      `json:"-"`
 }
 
 func (this *FieldDescriptorProto) Reset()         { *this = FieldDescriptorProto{} }
 func (this *FieldDescriptorProto) String() string { return proto.CompactTextString(this) }
+func (*FieldDescriptorProto) ProtoMessage()       {}
+
+func (this *FieldDescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *FieldDescriptorProto) GetNumber() int32 {
+	if this != nil && this.Number != nil {
+		return *this.Number
+	}
+	return 0
+}
+
+func (this *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label {
+	if this != nil && this.Label != nil {
+		return *this.Label
+	}
+	return 0
+}
+
+func (this *FieldDescriptorProto) GetType() FieldDescriptorProto_Type {
+	if this != nil && this.Type != nil {
+		return *this.Type
+	}
+	return 0
+}
+
+func (this *FieldDescriptorProto) GetTypeName() string {
+	if this != nil && this.TypeName != nil {
+		return *this.TypeName
+	}
+	return ""
+}
+
+func (this *FieldDescriptorProto) GetExtendee() string {
+	if this != nil && this.Extendee != nil {
+		return *this.Extendee
+	}
+	return ""
+}
+
+func (this *FieldDescriptorProto) GetDefaultValue() string {
+	if this != nil && this.DefaultValue != nil {
+		return *this.DefaultValue
+	}
+	return ""
+}
+
+func (this *FieldDescriptorProto) GetOptions() *FieldOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
 
 type EnumDescriptorProto struct {
-	Name             *string                     `protobuf:"bytes,1,opt,name=name"`
-	Value            []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value"`
-	Options          *EnumOptions                `protobuf:"bytes,3,opt,name=options"`
-	XXX_unrecognized []byte
+	Name             *string                     `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	Value            []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"`
+	Options          *EnumOptions                `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"`
+	XXX_unrecognized []byte                      `json:"-"`
 }
 
 func (this *EnumDescriptorProto) Reset()         { *this = EnumDescriptorProto{} }
 func (this *EnumDescriptorProto) String() string { return proto.CompactTextString(this) }
+func (*EnumDescriptorProto) ProtoMessage()       {}
+
+func (this *EnumDescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *EnumDescriptorProto) GetOptions() *EnumOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
 
 type EnumValueDescriptorProto struct {
-	Name             *string           `protobuf:"bytes,1,opt,name=name"`
-	Number           *int32            `protobuf:"varint,2,opt,name=number"`
-	Options          *EnumValueOptions `protobuf:"bytes,3,opt,name=options"`
-	XXX_unrecognized []byte
+	Name             *string           `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	Number           *int32            `protobuf:"varint,2,opt,name=number" json:"number,omitempty"`
+	Options          *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"`
+	XXX_unrecognized []byte            `json:"-"`
 }
 
 func (this *EnumValueDescriptorProto) Reset()         { *this = EnumValueDescriptorProto{} }
 func (this *EnumValueDescriptorProto) String() string { return proto.CompactTextString(this) }
+func (*EnumValueDescriptorProto) ProtoMessage()       {}
+
+func (this *EnumValueDescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *EnumValueDescriptorProto) GetNumber() int32 {
+	if this != nil && this.Number != nil {
+		return *this.Number
+	}
+	return 0
+}
+
+func (this *EnumValueDescriptorProto) GetOptions() *EnumValueOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
 
 type ServiceDescriptorProto struct {
-	Name             *string                  `protobuf:"bytes,1,opt,name=name"`
-	Method           []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method"`
-	Options          *ServiceOptions          `protobuf:"bytes,3,opt,name=options"`
-	XXX_unrecognized []byte
+	Name             *string                  `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	Method           []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"`
+	Stream           []*StreamDescriptorProto `protobuf:"bytes,4,rep,name=stream" json:"stream,omitempty"`
+	Options          *ServiceOptions          `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"`
+	XXX_unrecognized []byte                   `json:"-"`
 }
 
 func (this *ServiceDescriptorProto) Reset()         { *this = ServiceDescriptorProto{} }
 func (this *ServiceDescriptorProto) String() string { return proto.CompactTextString(this) }
+func (*ServiceDescriptorProto) ProtoMessage()       {}
+
+func (this *ServiceDescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *ServiceDescriptorProto) GetOptions() *ServiceOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
 
 type MethodDescriptorProto struct {
-	Name             *string        `protobuf:"bytes,1,opt,name=name"`
-	InputType        *string        `protobuf:"bytes,2,opt,name=input_type"`
-	OutputType       *string        `protobuf:"bytes,3,opt,name=output_type"`
-	Options          *MethodOptions `protobuf:"bytes,4,opt,name=options"`
-	XXX_unrecognized []byte
+	Name             *string        `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	InputType        *string        `protobuf:"bytes,2,opt,name=input_type" json:"input_type,omitempty"`
+	OutputType       *string        `protobuf:"bytes,3,opt,name=output_type" json:"output_type,omitempty"`
+	Options          *MethodOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"`
+	XXX_unrecognized []byte         `json:"-"`
 }
 
 func (this *MethodDescriptorProto) Reset()         { *this = MethodDescriptorProto{} }
 func (this *MethodDescriptorProto) String() string { return proto.CompactTextString(this) }
+func (*MethodDescriptorProto) ProtoMessage()       {}
+
+func (this *MethodDescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *MethodDescriptorProto) GetInputType() string {
+	if this != nil && this.InputType != nil {
+		return *this.InputType
+	}
+	return ""
+}
+
+func (this *MethodDescriptorProto) GetOutputType() string {
+	if this != nil && this.OutputType != nil {
+		return *this.OutputType
+	}
+	return ""
+}
+
+func (this *MethodDescriptorProto) GetOptions() *MethodOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
+
+type StreamDescriptorProto struct {
+	Name              *string        `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	ClientMessageType *string        `protobuf:"bytes,2,opt,name=client_message_type" json:"client_message_type,omitempty"`
+	ServerMessageType *string        `protobuf:"bytes,3,opt,name=server_message_type" json:"server_message_type,omitempty"`
+	Options           *StreamOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"`
+	XXX_unrecognized  []byte         `json:"-"`
+}
+
+func (this *StreamDescriptorProto) Reset()         { *this = StreamDescriptorProto{} }
+func (this *StreamDescriptorProto) String() string { return proto.CompactTextString(this) }
+func (*StreamDescriptorProto) ProtoMessage()       {}
+
+func (this *StreamDescriptorProto) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *StreamDescriptorProto) GetClientMessageType() string {
+	if this != nil && this.ClientMessageType != nil {
+		return *this.ClientMessageType
+	}
+	return ""
+}
+
+func (this *StreamDescriptorProto) GetServerMessageType() string {
+	if this != nil && this.ServerMessageType != nil {
+		return *this.ServerMessageType
+	}
+	return ""
+}
+
+func (this *StreamDescriptorProto) GetOptions() *StreamOptions {
+	if this != nil {
+		return this.Options
+	}
+	return nil
+}
 
 type FileOptions struct {
-	JavaPackage         *string                   `protobuf:"bytes,1,opt,name=java_package"`
-	JavaOuterClassname  *string                   `protobuf:"bytes,8,opt,name=java_outer_classname"`
-	JavaMultipleFiles   *bool                     `protobuf:"varint,10,opt,name=java_multiple_files,def=0"`
-	OptimizeFor         *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,enum=google_protobuf.FileOptions_OptimizeMode,def=1"`
-	CcGenericServices   *bool                     `protobuf:"varint,16,opt,name=cc_generic_services,def=1"`
-	JavaGenericServices *bool                     `protobuf:"varint,17,opt,name=java_generic_services,def=1"`
-	PyGenericServices   *bool                     `protobuf:"varint,18,opt,name=py_generic_services,def=1"`
-	UninterpretedOption []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option"`
-	XXX_extensions      map[int32][]byte
-	XXX_unrecognized    []byte
+	JavaPackage               *string                   `protobuf:"bytes,1,opt,name=java_package" json:"java_package,omitempty"`
+	JavaOuterClassname        *string                   `protobuf:"bytes,8,opt,name=java_outer_classname" json:"java_outer_classname,omitempty"`
+	JavaMultipleFiles         *bool                     `protobuf:"varint,10,opt,name=java_multiple_files,def=0" json:"java_multiple_files,omitempty"`
+	JavaGenerateEqualsAndHash *bool                     `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,def=0" json:"java_generate_equals_and_hash,omitempty"`
+	OptimizeFor               *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,enum=proto2.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"`
+	GoPackage                 *string                   `protobuf:"bytes,11,opt,name=go_package" json:"go_package,omitempty"`
+	CcGenericServices         *bool                     `protobuf:"varint,16,opt,name=cc_generic_services,def=0" json:"cc_generic_services,omitempty"`
+	JavaGenericServices       *bool                     `protobuf:"varint,17,opt,name=java_generic_services,def=0" json:"java_generic_services,omitempty"`
+	PyGenericServices         *bool                     `protobuf:"varint,18,opt,name=py_generic_services,def=0" json:"py_generic_services,omitempty"`
+	UninterpretedOption       []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions            map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized          []byte                    `json:"-"`
 }
 
 func (this *FileOptions) Reset()         { *this = FileOptions{} }
 func (this *FileOptions) String() string { return proto.CompactTextString(this) }
+func (*FileOptions) ProtoMessage()       {}
 
 var extRange_FileOptions = []proto.ExtensionRange{
-	proto.ExtensionRange{1000, 536870911},
+	{1000, 536870911},
 }
 
 func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_FileOptions
 }
-func (this *FileOptions) ExtensionMap() map[int32][]byte {
+func (this *FileOptions) ExtensionMap() map[int32]proto.Extension {
 	if this.XXX_extensions == nil {
-		this.XXX_extensions = make(map[int32][]byte)
+		this.XXX_extensions = make(map[int32]proto.Extension)
 	}
 	return this.XXX_extensions
 }
 
 const Default_FileOptions_JavaMultipleFiles bool = false
+const Default_FileOptions_JavaGenerateEqualsAndHash bool = false
 const Default_FileOptions_OptimizeFor FileOptions_OptimizeMode = FileOptions_SPEED
-const Default_FileOptions_CcGenericServices bool = true
-const Default_FileOptions_JavaGenericServices bool = true
-const Default_FileOptions_PyGenericServices bool = true
+const Default_FileOptions_CcGenericServices bool = false
+const Default_FileOptions_JavaGenericServices bool = false
+const Default_FileOptions_PyGenericServices bool = false
+
+func (this *FileOptions) GetJavaPackage() string {
+	if this != nil && this.JavaPackage != nil {
+		return *this.JavaPackage
+	}
+	return ""
+}
+
+func (this *FileOptions) GetJavaOuterClassname() string {
+	if this != nil && this.JavaOuterClassname != nil {
+		return *this.JavaOuterClassname
+	}
+	return ""
+}
+
+func (this *FileOptions) GetJavaMultipleFiles() bool {
+	if this != nil && this.JavaMultipleFiles != nil {
+		return *this.JavaMultipleFiles
+	}
+	return Default_FileOptions_JavaMultipleFiles
+}
+
+func (this *FileOptions) GetJavaGenerateEqualsAndHash() bool {
+	if this != nil && this.JavaGenerateEqualsAndHash != nil {
+		return *this.JavaGenerateEqualsAndHash
+	}
+	return Default_FileOptions_JavaGenerateEqualsAndHash
+}
+
+func (this *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode {
+	if this != nil && this.OptimizeFor != nil {
+		return *this.OptimizeFor
+	}
+	return Default_FileOptions_OptimizeFor
+}
+
+func (this *FileOptions) GetGoPackage() string {
+	if this != nil && this.GoPackage != nil {
+		return *this.GoPackage
+	}
+	return ""
+}
+
+func (this *FileOptions) GetCcGenericServices() bool {
+	if this != nil && this.CcGenericServices != nil {
+		return *this.CcGenericServices
+	}
+	return Default_FileOptions_CcGenericServices
+}
+
+func (this *FileOptions) GetJavaGenericServices() bool {
+	if this != nil && this.JavaGenericServices != nil {
+		return *this.JavaGenericServices
+	}
+	return Default_FileOptions_JavaGenericServices
+}
+
+func (this *FileOptions) GetPyGenericServices() bool {
+	if this != nil && this.PyGenericServices != nil {
+		return *this.PyGenericServices
+	}
+	return Default_FileOptions_PyGenericServices
+}
 
 type MessageOptions struct {
-	MessageSetWireFormat         *bool                  `protobuf:"varint,1,opt,name=message_set_wire_format,def=0"`
-	NoStandardDescriptorAccessor *bool                  `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,def=0"`
-	UninterpretedOption          []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
-	XXX_extensions               map[int32][]byte
-	XXX_unrecognized             []byte
+	MessageSetWireFormat         *bool                     `protobuf:"varint,1,opt,name=message_set_wire_format,def=0" json:"message_set_wire_format,omitempty"`
+	NoStandardDescriptorAccessor *bool                     `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,def=0" json:"no_standard_descriptor_accessor,omitempty"`
+	UninterpretedOption          []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions               map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized             []byte                    `json:"-"`
 }
 
 func (this *MessageOptions) Reset()         { *this = MessageOptions{} }
 func (this *MessageOptions) String() string { return proto.CompactTextString(this) }
+func (*MessageOptions) ProtoMessage()       {}
 
 var extRange_MessageOptions = []proto.ExtensionRange{
-	proto.ExtensionRange{1000, 536870911},
+	{1000, 536870911},
 }
 
 func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_MessageOptions
 }
-func (this *MessageOptions) ExtensionMap() map[int32][]byte {
+func (this *MessageOptions) ExtensionMap() map[int32]proto.Extension {
 	if this.XXX_extensions == nil {
-		this.XXX_extensions = make(map[int32][]byte)
+		this.XXX_extensions = make(map[int32]proto.Extension)
 	}
 	return this.XXX_extensions
 }
@@ -331,158 +693,331 @@ func (this *MessageOptions) ExtensionMap() map[int32][]byte {
 const Default_MessageOptions_MessageSetWireFormat bool = false
 const Default_MessageOptions_NoStandardDescriptorAccessor bool = false
 
+func (this *MessageOptions) GetMessageSetWireFormat() bool {
+	if this != nil && this.MessageSetWireFormat != nil {
+		return *this.MessageSetWireFormat
+	}
+	return Default_MessageOptions_MessageSetWireFormat
+}
+
+func (this *MessageOptions) GetNoStandardDescriptorAccessor() bool {
+	if this != nil && this.NoStandardDescriptorAccessor != nil {
+		return *this.NoStandardDescriptorAccessor
+	}
+	return Default_MessageOptions_NoStandardDescriptorAccessor
+}
+
 type FieldOptions struct {
-	Ctype               *FieldOptions_CType    `protobuf:"varint,1,opt,name=ctype,enum=google_protobuf.FieldOptions_CType,def=0"`
-	Packed              *bool                  `protobuf:"varint,2,opt,name=packed"`
-	Deprecated          *bool                  `protobuf:"varint,3,opt,name=deprecated,def=0"`
-	ExperimentalMapKey  *string                `protobuf:"bytes,9,opt,name=experimental_map_key"`
-	Weak                *bool                  `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"`
-	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
-	XXX_extensions      map[int32][]byte
-	XXX_unrecognized    []byte
+	Ctype               *FieldOptions_CType       `protobuf:"varint,1,opt,name=ctype,enum=proto2.FieldOptions_CType,def=0" json:"ctype,omitempty"`
+	Packed              *bool                     `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"`
+	Lazy                *bool                     `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"`
+	Deprecated          *bool                     `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"`
+	ExperimentalMapKey  *string                   `protobuf:"bytes,9,opt,name=experimental_map_key" json:"experimental_map_key,omitempty"`
+	Weak                *bool                     `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"`
+	UninterpretedOption []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions      map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized    []byte                    `json:"-"`
 }
 
 func (this *FieldOptions) Reset()         { *this = FieldOptions{} }
 func (this *FieldOptions) String() string { return proto.CompactTextString(this) }
+func (*FieldOptions) ProtoMessage()       {}
 
 var extRange_FieldOptions = []proto.ExtensionRange{
-	proto.ExtensionRange{1000, 536870911},
+	{1000, 536870911},
 }
 
 func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_FieldOptions
 }
-func (this *FieldOptions) ExtensionMap() map[int32][]byte {
+func (this *FieldOptions) ExtensionMap() map[int32]proto.Extension {
 	if this.XXX_extensions == nil {
-		this.XXX_extensions = make(map[int32][]byte)
+		this.XXX_extensions = make(map[int32]proto.Extension)
 	}
 	return this.XXX_extensions
 }
 
 const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING
+const Default_FieldOptions_Lazy bool = false
 const Default_FieldOptions_Deprecated bool = false
+const Default_FieldOptions_Weak bool = false
+
+func (this *FieldOptions) GetCtype() FieldOptions_CType {
+	if this != nil && this.Ctype != nil {
+		return *this.Ctype
+	}
+	return Default_FieldOptions_Ctype
+}
+
+func (this *FieldOptions) GetPacked() bool {
+	if this != nil && this.Packed != nil {
+		return *this.Packed
+	}
+	return false
+}
+
+func (this *FieldOptions) GetLazy() bool {
+	if this != nil && this.Lazy != nil {
+		return *this.Lazy
+	}
+	return Default_FieldOptions_Lazy
+}
+
+func (this *FieldOptions) GetDeprecated() bool {
+	if this != nil && this.Deprecated != nil {
+		return *this.Deprecated
+	}
+	return Default_FieldOptions_Deprecated
+}
+
+func (this *FieldOptions) GetExperimentalMapKey() string {
+	if this != nil && this.ExperimentalMapKey != nil {
+		return *this.ExperimentalMapKey
+	}
+	return ""
+}
+
+func (this *FieldOptions) GetWeak() bool {
+	if this != nil && this.Weak != nil {
+		return *this.Weak
+	}
+	return Default_FieldOptions_Weak
+}
 
 type EnumOptions struct {
-	Proto1Name          *string                `protobuf:"bytes,1,opt,name=proto1_name" json:"proto1_name,omitempty"`
-	AllowAlias          *bool                  `protobuf:"varint,2,opt,name=allow_alias,def=1" json:"allow_alias,omitempty"`
-	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
-	XXX_extensions      map[int32][]byte
-	XXX_unrecognized    []byte
+	AllowAlias          *bool                     `protobuf:"varint,2,opt,name=allow_alias,def=1" json:"allow_alias,omitempty"`
+	UninterpretedOption []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions      map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized    []byte                    `json:"-"`
 }
 
 func (this *EnumOptions) Reset()         { *this = EnumOptions{} }
 func (this *EnumOptions) String() string { return proto.CompactTextString(this) }
+func (*EnumOptions) ProtoMessage()       {}
 
 var extRange_EnumOptions = []proto.ExtensionRange{
-	proto.ExtensionRange{1000, 536870911},
+	{1000, 536870911},
 }
 
 func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_EnumOptions
 }
-func (this *EnumOptions) ExtensionMap() map[int32][]byte {
+func (this *EnumOptions) ExtensionMap() map[int32]proto.Extension {
 	if this.XXX_extensions == nil {
-		this.XXX_extensions = make(map[int32][]byte)
+		this.XXX_extensions = make(map[int32]proto.Extension)
 	}
 	return this.XXX_extensions
 }
 
 const Default_EnumOptions_AllowAlias bool = true
 
+func (this *EnumOptions) GetAllowAlias() bool {
+	if this != nil && this.AllowAlias != nil {
+		return *this.AllowAlias
+	}
+	return Default_EnumOptions_AllowAlias
+}
+
 type EnumValueOptions struct {
-	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
-	XXX_extensions      map[int32][]byte
-	XXX_unrecognized    []byte
+	UninterpretedOption []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions      map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized    []byte                    `json:"-"`
 }
 
 func (this *EnumValueOptions) Reset()         { *this = EnumValueOptions{} }
 func (this *EnumValueOptions) String() string { return proto.CompactTextString(this) }
+func (*EnumValueOptions) ProtoMessage()       {}
 
 var extRange_EnumValueOptions = []proto.ExtensionRange{
-	proto.ExtensionRange{1000, 536870911},
+	{1000, 536870911},
 }
 
 func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_EnumValueOptions
 }
-func (this *EnumValueOptions) ExtensionMap() map[int32][]byte {
+func (this *EnumValueOptions) ExtensionMap() map[int32]proto.Extension {
 	if this.XXX_extensions == nil {
-		this.XXX_extensions = make(map[int32][]byte)
+		this.XXX_extensions = make(map[int32]proto.Extension)
 	}
 	return this.XXX_extensions
 }
 
 type ServiceOptions struct {
-	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
-	XXX_extensions      map[int32][]byte
-	XXX_unrecognized    []byte
+	UninterpretedOption []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions      map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized    []byte                    `json:"-"`
 }
 
 func (this *ServiceOptions) Reset()         { *this = ServiceOptions{} }
 func (this *ServiceOptions) String() string { return proto.CompactTextString(this) }
+func (*ServiceOptions) ProtoMessage()       {}
 
 var extRange_ServiceOptions = []proto.ExtensionRange{
-	proto.ExtensionRange{1000, 536870911},
+	{1000, 536870911},
 }
 
 func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_ServiceOptions
 }
-func (this *ServiceOptions) ExtensionMap() map[int32][]byte {
+func (this *ServiceOptions) ExtensionMap() map[int32]proto.Extension {
 	if this.XXX_extensions == nil {
-		this.XXX_extensions = make(map[int32][]byte)
+		this.XXX_extensions = make(map[int32]proto.Extension)
 	}
 	return this.XXX_extensions
 }
 
 type MethodOptions struct {
-	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
-	XXX_extensions      map[int32][]byte
-	XXX_unrecognized    []byte
+	UninterpretedOption []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions      map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized    []byte                    `json:"-"`
 }
 
 func (this *MethodOptions) Reset()         { *this = MethodOptions{} }
 func (this *MethodOptions) String() string { return proto.CompactTextString(this) }
+func (*MethodOptions) ProtoMessage()       {}
 
 var extRange_MethodOptions = []proto.ExtensionRange{
-	proto.ExtensionRange{1000, 536870911},
+	{1000, 536870911},
 }
 
 func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_MethodOptions
 }
-func (this *MethodOptions) ExtensionMap() map[int32][]byte {
+func (this *MethodOptions) ExtensionMap() map[int32]proto.Extension {
+	if this.XXX_extensions == nil {
+		this.XXX_extensions = make(map[int32]proto.Extension)
+	}
+	return this.XXX_extensions
+}
+
+type StreamOptions struct {
+	UninterpretedOption []*UninterpretedOption    `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
+	XXX_extensions      map[int32]proto.Extension `json:"-"`
+	XXX_unrecognized    []byte                    `json:"-"`
+}
+
+func (this *StreamOptions) Reset()         { *this = StreamOptions{} }
+func (this *StreamOptions) String() string { return proto.CompactTextString(this) }
+func (*StreamOptions) ProtoMessage()       {}
+
+var extRange_StreamOptions = []proto.ExtensionRange{
+	{1000, 536870911},
+}
+
+func (*StreamOptions) ExtensionRangeArray() []proto.ExtensionRange {
+	return extRange_StreamOptions
+}
+func (this *StreamOptions) ExtensionMap() map[int32]proto.Extension {
 	if this.XXX_extensions == nil {
-		this.XXX_extensions = make(map[int32][]byte)
+		this.XXX_extensions = make(map[int32]proto.Extension)
 	}
 	return this.XXX_extensions
 }
 
 type UninterpretedOption struct {
-	Name             []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name"`
-	IdentifierValue  *string                         `protobuf:"bytes,3,opt,name=identifier_value"`
-	PositiveIntValue *uint64                         `protobuf:"varint,4,opt,name=positive_int_value"`
-	NegativeIntValue *int64                          `protobuf:"varint,5,opt,name=negative_int_value"`
-	DoubleValue      *float64                        `protobuf:"fixed64,6,opt,name=double_value"`
-	StringValue      []byte                          `protobuf:"bytes,7,opt,name=string_value"`
-	XXX_unrecognized []byte
+	Name             []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"`
+	IdentifierValue  *string                         `protobuf:"bytes,3,opt,name=identifier_value" json:"identifier_value,omitempty"`
+	PositiveIntValue *uint64                         `protobuf:"varint,4,opt,name=positive_int_value" json:"positive_int_value,omitempty"`
+	NegativeIntValue *int64                          `protobuf:"varint,5,opt,name=negative_int_value" json:"negative_int_value,omitempty"`
+	DoubleValue      *float64                        `protobuf:"fixed64,6,opt,name=double_value" json:"double_value,omitempty"`
+	StringValue      []byte                          `protobuf:"bytes,7,opt,name=string_value" json:"string_value,omitempty"`
+	AggregateValue   *string                         `protobuf:"bytes,8,opt,name=aggregate_value" json:"aggregate_value,omitempty"`
+	XXX_unrecognized []byte                          `json:"-"`
 }
 
 func (this *UninterpretedOption) Reset()         { *this = UninterpretedOption{} }
 func (this *UninterpretedOption) String() string { return proto.CompactTextString(this) }
+func (*UninterpretedOption) ProtoMessage()       {}
+
+func (this *UninterpretedOption) GetIdentifierValue() string {
+	if this != nil && this.IdentifierValue != nil {
+		return *this.IdentifierValue
+	}
+	return ""
+}
+
+func (this *UninterpretedOption) GetPositiveIntValue() uint64 {
+	if this != nil && this.PositiveIntValue != nil {
+		return *this.PositiveIntValue
+	}
+	return 0
+}
+
+func (this *UninterpretedOption) GetNegativeIntValue() int64 {
+	if this != nil && this.NegativeIntValue != nil {
+		return *this.NegativeIntValue
+	}
+	return 0
+}
+
+func (this *UninterpretedOption) GetDoubleValue() float64 {
+	if this != nil && this.DoubleValue != nil {
+		return *this.DoubleValue
+	}
+	return 0
+}
+
+func (this *UninterpretedOption) GetStringValue() []byte {
+	if this != nil {
+		return this.StringValue
+	}
+	return nil
+}
+
+func (this *UninterpretedOption) GetAggregateValue() string {
+	if this != nil && this.AggregateValue != nil {
+		return *this.AggregateValue
+	}
+	return ""
+}
 
 type UninterpretedOption_NamePart struct {
-	NamePart         *string `protobuf:"bytes,1,req,name=name_part"`
-	IsExtension      *bool   `protobuf:"varint,2,req,name=is_extension"`
-	XXX_unrecognized []byte
+	NamePart         *string `protobuf:"bytes,1,req,name=name_part" json:"name_part,omitempty"`
+	IsExtension      *bool   `protobuf:"varint,2,req,name=is_extension" json:"is_extension,omitempty"`
+	XXX_unrecognized []byte  `json:"-"`
 }
 
 func (this *UninterpretedOption_NamePart) Reset()         { *this = UninterpretedOption_NamePart{} }
 func (this *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(this) }
+func (*UninterpretedOption_NamePart) ProtoMessage()       {}
+
+func (this *UninterpretedOption_NamePart) GetNamePart() string {
+	if this != nil && this.NamePart != nil {
+		return *this.NamePart
+	}
+	return ""
+}
+
+func (this *UninterpretedOption_NamePart) GetIsExtension() bool {
+	if this != nil && this.IsExtension != nil {
+		return *this.IsExtension
+	}
+	return false
+}
+
+type SourceCodeInfo struct {
+	Location         []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"`
+	XXX_unrecognized []byte                     `json:"-"`
+}
+
+func (this *SourceCodeInfo) Reset()         { *this = SourceCodeInfo{} }
+func (this *SourceCodeInfo) String() string { return proto.CompactTextString(this) }
+func (*SourceCodeInfo) ProtoMessage()       {}
+
+type SourceCodeInfo_Location struct {
+	Path             []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"`
+	Span             []int32 `protobuf:"varint,2,rep,packed,name=span" json:"span,omitempty"`
+	XXX_unrecognized []byte  `json:"-"`
+}
+
+func (this *SourceCodeInfo_Location) Reset()         { *this = SourceCodeInfo_Location{} }
+func (this *SourceCodeInfo_Location) String() string { return proto.CompactTextString(this) }
+func (*SourceCodeInfo_Location) ProtoMessage()       {}
 
 func init() {
 	proto.RegisterEnum("google_protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value)
 	proto.RegisterEnum("google_protobuf.FieldDescriptorProto_Label", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value)
 	proto.RegisterEnum("google_protobuf.FileOptions_OptimizeMode", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value)
 	proto.RegisterEnum("google_protobuf.FieldOptions_CType", FieldOptions_CType_name, FieldOptions_CType_value)
+	proto.RegisterEnum("google_protobuf.StreamOptions_TokenUnit", StreamOptions_TokenUnit_name, StreamOptions_TokenUnit_value)
 }

+ 105 - 32
protoc-gen-go/generator/generator.go

@@ -118,7 +118,7 @@ func (d *Descriptor) TypeName() []string {
 	s := make([]string, n, n)
 	for parent := d; parent != nil; parent = parent.parent {
 		n--
-		s[n] = proto.GetString(parent.Name)
+		s[n] = parent.GetName()
 	}
 	d.typename = s
 	return s
@@ -139,7 +139,7 @@ func (e *EnumDescriptor) TypeName() (s []string) {
 	if e.typename != nil {
 		return e.typename
 	}
-	name := proto.GetString(e.Name)
+	name := e.GetName()
 	if e.parent == nil {
 		s = make([]string, 1)
 	} else {
@@ -167,8 +167,8 @@ func (e *EnumDescriptor) prefix() string {
 // The integer value of the named constant in this enumerated type.
 func (e *EnumDescriptor) integerValueAsString(name string) string {
 	for _, c := range e.Value {
-		if proto.GetString(c.Name) == name {
-			return fmt.Sprint(proto.GetInt32(c.Number))
+		if c.GetName() == name {
+			return fmt.Sprint(c.GetNumber())
 		}
 	}
 	log.Fatal("cannot find value for enum constant")
@@ -186,7 +186,7 @@ type ExtensionDescriptor struct {
 // TypeName returns the elements of the dotted type name.
 // The package name is not part of this name.
 func (e *ExtensionDescriptor) TypeName() (s []string) {
-	name := proto.GetString(e.Name)
+	name := e.GetName()
 	if e.parent == nil {
 		// top-level extension
 		s = make([]string, 1)
@@ -245,11 +245,11 @@ func (d *FileDescriptor) PackageName() string { return uniquePackageOf(d.FileDes
 func (d *FileDescriptor) goPackageName() (name string, explicit bool) {
 
 	// Does the file have a package clause?
-	if pkg := proto.GetString(d.Package); pkg != "" {
+	if pkg := d.GetPackage(); pkg != "" {
 		return pkg, false
 	}
 	// Use the file base name.
-	return BaseName(proto.GetString(d.Name)), false
+	return BaseName(d.GetName()), false
 }
 
 func (d *FileDescriptor) addExport(obj Object, symbol Symbol) {
@@ -322,7 +322,7 @@ type Object interface {
 func uniquePackageOf(fd *descriptor.FileDescriptorProto) string {
 	s, ok := uniquePackageName[fd]
 	if !ok {
-		log.Fatal("internal error: no package name defined for", proto.GetString(fd.Name))
+		log.Fatal("internal error: no package name defined for", fd.GetName())
 	}
 	return s
 }
@@ -550,7 +550,7 @@ AllFiles:
 		}
 		// The file is a dependency, so we want to ignore its go_package option
 		// because that is only relevant for its specific generated output.
-		pkg := proto.GetString(f.Package)
+		pkg := f.GetPackage()
 		if pkg == "" {
 			pkg = BaseName(*f.Name)
 		}
@@ -585,7 +585,7 @@ FindFiles:
 	for i, fileName := range g.Request.FileToGenerate {
 		// Search the list.  This algorithm is n^2 but n is tiny.
 		for _, file := range g.allFiles {
-			if fileName == proto.GetString(file.Name) {
+			if fileName == file.GetName() {
 				g.genFiles[i] = file
 				continue FindFiles
 			}
@@ -608,7 +608,7 @@ func (g *Generator) buildNestedDescriptors(descs []*Descriptor) {
 				}
 			}
 			if n != len(desc.NestedType) {
-				g.Fail("internal error: nesting failure for", proto.GetString(desc.Name))
+				g.Fail("internal error: nesting failure for", desc.GetName())
 			}
 		}
 	}
@@ -701,7 +701,7 @@ func (g *Generator) BuildTypeNameMap() {
 		// The names in this loop are defined by the proto world, not us, so the
 		// package name may be empty.  If so, the dotted package name of X will
 		// be ".X"; otherwise it will be ".pkg.X".
-		dottedPkg := "." + proto.GetString(f.Package)
+		dottedPkg := "." + f.GetPackage()
 		if dottedPkg != "." {
 			dottedPkg += "."
 		}
@@ -837,7 +837,7 @@ func (g *Generator) FileOf(fd *descriptor.FileDescriptorProto) *FileDescriptor {
 			return file
 		}
 	}
-	g.Fail("could not find file in table:", proto.GetString(fd.Name))
+	g.Fail("could not find file in table:", fd.GetName())
 	return nil
 }
 
@@ -896,7 +896,7 @@ func (g *Generator) generateHeader() {
 
 func (g *Generator) fileByName(filename string) *FileDescriptor {
 	for _, fd := range g.allFiles {
-		if proto.GetString(fd.Name) == filename {
+		if fd.GetName() == filename {
 			return fd
 		}
 	}
@@ -1074,7 +1074,7 @@ func (g *Generator) goTag(field *descriptor.FieldDescriptorProto, wiretype strin
 	case isRepeated(field):
 		optrepreq = "rep"
 	}
-	defaultValue := proto.GetString(field.DefaultValue)
+	defaultValue := field.GetDefaultValue()
 	if defaultValue != "" {
 		switch *field.Type {
 		case descriptor.FieldDescriptorProto_TYPE_BOOL:
@@ -1088,7 +1088,7 @@ func (g *Generator) goTag(field *descriptor.FieldDescriptorProto, wiretype strin
 			// Nothing to do. Quoting is done for the whole tag.
 		case descriptor.FieldDescriptorProto_TYPE_ENUM:
 			// For enums we need to provide the integer constant.
-			obj := g.ObjectNamed(proto.GetString(field.TypeName))
+			obj := g.ObjectNamed(field.GetTypeName())
 			enum, ok := obj.(*EnumDescriptor)
 			if !ok {
 				g.Fail("enum type inconsistent for", CamelCaseSlice(obj.TypeName()))
@@ -1101,18 +1101,18 @@ func (g *Generator) goTag(field *descriptor.FieldDescriptorProto, wiretype strin
 	if *field.Type == descriptor.FieldDescriptorProto_TYPE_ENUM {
 		// We avoid using obj.PackageName(), because we want to use the
 		// original (proto-world) package name.
-		obj := g.ObjectNamed(proto.GetString(field.TypeName))
+		obj := g.ObjectNamed(field.GetTypeName())
 		enum = ",enum="
-		if pkg := proto.GetString(obj.File().Package); pkg != "" {
+		if pkg := obj.File().GetPackage(); pkg != "" {
 			enum += pkg + "."
 		}
 		enum += CamelCaseSlice(obj.TypeName())
 	}
 	packed := ""
-	if field.Options != nil && proto.GetBool(field.Options.Packed) {
+	if field.Options != nil && field.Options.GetPacked() {
 		packed = ",packed"
 	}
-	fieldName := proto.GetString(field.Name)
+	fieldName := field.GetName()
 	name := fieldName
 	if *field.Type == descriptor.FieldDescriptorProto_TYPE_GROUP {
 		// We must use the type name for groups instead of
@@ -1131,7 +1131,7 @@ func (g *Generator) goTag(field *descriptor.FieldDescriptorProto, wiretype strin
 	}
 	return Quote(fmt.Sprintf("%s,%d,%s%s%s%s%s",
 		wiretype,
-		proto.GetInt32(field.Number),
+		field.GetNumber(),
 		optrepreq,
 		packed,
 		name,
@@ -1191,15 +1191,15 @@ func (g *Generator) GoType(message *Descriptor, field *descriptor.FieldDescripto
 	case descriptor.FieldDescriptorProto_TYPE_STRING:
 		typ, wire = "string", "bytes"
 	case descriptor.FieldDescriptorProto_TYPE_GROUP:
-		desc := g.ObjectNamed(proto.GetString(field.TypeName))
+		desc := g.ObjectNamed(field.GetTypeName())
 		typ, wire = "*"+g.TypeName(desc), "group"
 	case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
-		desc := g.ObjectNamed(proto.GetString(field.TypeName))
+		desc := g.ObjectNamed(field.GetTypeName())
 		typ, wire = "*"+g.TypeName(desc), "bytes"
 	case descriptor.FieldDescriptorProto_TYPE_BYTES:
 		typ, wire = "[]byte", "bytes"
 	case descriptor.FieldDescriptorProto_TYPE_ENUM:
-		desc := g.ObjectNamed(proto.GetString(field.TypeName))
+		desc := g.ObjectNamed(field.GetTypeName())
 		typ, wire = g.TypeName(desc), "varint"
 	case descriptor.FieldDescriptorProto_TYPE_SFIXED32:
 		typ, wire = "int32", "fixed32"
@@ -1210,7 +1210,7 @@ func (g *Generator) GoType(message *Descriptor, field *descriptor.FieldDescripto
 	case descriptor.FieldDescriptorProto_TYPE_SINT64:
 		typ, wire = "int64", "zigzag64"
 	default:
-		g.Fail("unknown type for", proto.GetString(field.Name))
+		g.Fail("unknown type for", field.GetName())
 	}
 	if isRepeated(field) {
 		typ = "[]" + typ
@@ -1251,6 +1251,7 @@ func (g *Generator) generateMessage(message *Descriptor) {
 	for _, n := range methodNames {
 		usedNames[n] = true
 	}
+	fieldNames := make(map[*descriptor.FieldDescriptorProto]string)
 	g.P("type ", ccTypeName, " struct {")
 	g.In()
 	for _, field := range message.Field {
@@ -1259,15 +1260,15 @@ func (g *Generator) generateMessage(message *Descriptor) {
 			fieldname += "_"
 		}
 		usedNames[fieldname] = true
+		fieldNames[field] = fieldname
 		typename, wiretype := g.GoType(message, field)
 		jsonName := *field.Name
-		// This is a hack that is going away. TODO: remove this.
-		if field.Options != nil && proto.GetBool(field.Options.Weak) {
+		if field.Options != nil && field.Options.GetWeak() {
 			typename = "[]byte"
 		}
 		tag := fmt.Sprintf("`protobuf:%s json:%q`", g.goTag(field, wiretype), jsonName+",omitempty")
 		g.P(fieldname, "\t", typename, "\t", tag)
-		g.RecordTypeUse(proto.GetString(field.TypeName))
+		g.RecordTypeUse(field.GetTypeName())
 	}
 	if len(message.ExtensionRange) > 0 {
 		g.P("XXX_extensions\t\tmap[int32]", g.ProtoPkg, ".Extension `json:\"-\"`")
@@ -1286,7 +1287,7 @@ func (g *Generator) generateMessage(message *Descriptor) {
 	if len(message.ExtensionRange) > 0 {
 		hasExtensions = true
 		// message_set_wire_format only makes sense when extensions are defined.
-		if opts := message.Options; opts != nil && proto.GetBool(opts.MessageSetWireFormat) {
+		if opts := message.Options; opts != nil && opts.GetMessageSetWireFormat() {
 			isMessageSet = true
 			g.P()
 			g.P("func (this *", ccTypeName, ") Marshal() ([]byte, error) {")
@@ -1333,12 +1334,14 @@ func (g *Generator) generateMessage(message *Descriptor) {
 	g.file.addExport(message, messageSymbol{ccTypeName, hasExtensions, isMessageSet})
 
 	// Default constants
+	defNames := make(map[*descriptor.FieldDescriptorProto]string)
 	for _, field := range message.Field {
-		def := proto.GetString(field.DefaultValue)
+		def := field.GetDefaultValue()
 		if def == "" {
 			continue
 		}
 		fieldname := "Default_" + ccTypeName + "_" + CamelCase(*field.Name)
+		defNames[field] = fieldname
 		typename, _ := g.GoType(message, field)
 		if typename[0] == '*' {
 			typename = typename[1:]
@@ -1367,7 +1370,7 @@ func (g *Generator) generateMessage(message *Descriptor) {
 			kind = "var "
 		case *field.Type == descriptor.FieldDescriptorProto_TYPE_ENUM:
 			// Must be an enum.  Need to construct the prefixed name.
-			obj := g.ObjectNamed(proto.GetString(field.TypeName))
+			obj := g.ObjectNamed(field.GetTypeName())
 			enum, ok := obj.(*EnumDescriptor)
 			if !ok {
 				log.Println("don't know how to generate constant for", fieldname)
@@ -1380,6 +1383,76 @@ func (g *Generator) generateMessage(message *Descriptor) {
 	}
 	g.P()
 
+	// Field getters
+	// TODO: Generate getters for publicly imported aliases, if required.
+	for _, field := range message.Field {
+		if isRepeated(field) {
+			continue
+		}
+		fname := fieldNames[field]
+		typename, _ := g.GoType(message, field)
+		if field.Options != nil && field.Options.GetWeak() {
+			// TODO: weak fields
+			continue
+		}
+		mname := "Get" + fname
+		star := ""
+		if needsStar(*field.Type) && typename[0] == '*' {
+			typename = typename[1:]
+			star = "*"
+		}
+		g.P("func (this *", ccTypeName, ") "+mname+"() "+typename+" {")
+		g.In()
+		def, hasDef := defNames[field]
+		typeDefaultIsNil := false // whether this field type's default value is a literal nil unless specified
+		switch *field.Type {
+		case descriptor.FieldDescriptorProto_TYPE_BYTES:
+			typeDefaultIsNil = !hasDef
+		case descriptor.FieldDescriptorProto_TYPE_GROUP, descriptor.FieldDescriptorProto_TYPE_MESSAGE:
+			typeDefaultIsNil = true
+		}
+		if typeDefaultIsNil {
+			// A bytes field with no explicit default needs less generated code,
+			// as does a message or group field.
+			g.P("if this != nil {")
+			g.In()
+			g.P("return this." + fname)
+			g.Out()
+			g.P("}")
+			g.P("return nil")
+			g.Out()
+			g.P("}")
+			g.P()
+			continue
+		}
+		g.P("if this != nil && this." + fname + " != nil {")
+		g.In()
+		g.P("return " + star + "this." + fname)
+		g.Out()
+		g.P("}")
+		if hasDef {
+			if *field.Type != descriptor.FieldDescriptorProto_TYPE_BYTES {
+				g.P("return " + def)
+			} else {
+				// The default is a []byte var.
+				// Make a copy when returning it to be safe.
+				g.P("return append([]byte(nil), ", def, "...)")
+			}
+		} else {
+			switch *field.Type {
+			case descriptor.FieldDescriptorProto_TYPE_BOOL:
+				g.P("return false")
+			case descriptor.FieldDescriptorProto_TYPE_STRING:
+				g.P(`return ""`)
+			default:
+				g.P("return 0")
+			}
+		}
+		g.Out()
+		g.P("}")
+		g.P()
+	}
+
 	for _, ext := range message.ext {
 		g.generateExtension(ext)
 	}
@@ -1449,7 +1522,7 @@ func (g *Generator) generateInitFunction() {
 
 func (g *Generator) generateEnumRegistration(enum *EnumDescriptor) {
 	// // We always print the full (proto-world) package name here.
-	pkg := proto.GetString(enum.File().Package)
+	pkg := enum.File().GetPackage()
 	if pkg != "" {
 		pkg += "."
 	}

+ 1 - 1
protoc-gen-go/main.go

@@ -66,7 +66,7 @@ func main() {
 		g.Fail("no files to generate")
 	}
 
-	g.CommandLineParameters(proto.GetString(g.Request.Parameter))
+	g.CommandLineParameters(g.Request.GetParameter())
 
 	// Create a wrapped version of the Descriptors and EnumDescriptors that
 	// point to the file that defines them.

+ 47 - 14
protoc-gen-go/plugin/plugin.pb.go

@@ -5,45 +5,78 @@ package google_protobuf_compiler
 
 import proto "code.google.com/p/goprotobuf/proto"
 import "math"
-
 import google_protobuf "code.google.com/p/goprotobuf/protoc-gen-go/descriptor"
 
-// Reference proto, math & os imports to suppress error if they are not otherwise used.
+// Reference proto and math imports to suppress error if they are not otherwise used.
 var _ = proto.GetString
 var _ = math.Inf
-var _ error
 
 type CodeGeneratorRequest struct {
-	FileToGenerate   []string                               `protobuf:"bytes,1,rep,name=file_to_generate"`
-	Parameter        *string                                `protobuf:"bytes,2,opt,name=parameter"`
-	ProtoFile        []*google_protobuf.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file"`
-	XXX_unrecognized []byte
+	FileToGenerate   []string                               `protobuf:"bytes,1,rep,name=file_to_generate" json:"file_to_generate,omitempty"`
+	Parameter        *string                                `protobuf:"bytes,2,opt,name=parameter" json:"parameter,omitempty"`
+	ProtoFile        []*google_protobuf.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file" json:"proto_file,omitempty"`
+	XXX_unrecognized []byte                                 `json:"-"`
 }
 
 func (this *CodeGeneratorRequest) Reset()         { *this = CodeGeneratorRequest{} }
 func (this *CodeGeneratorRequest) String() string { return proto.CompactTextString(this) }
 func (*CodeGeneratorRequest) ProtoMessage()       {}
 
+func (this *CodeGeneratorRequest) GetParameter() string {
+	if this != nil && this.Parameter != nil {
+		return *this.Parameter
+	}
+	return ""
+}
+
 type CodeGeneratorResponse struct {
-	Error            *string                       `protobuf:"bytes,1,opt,name=error"`
-	File             []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file"`
-	XXX_unrecognized []byte
+	Error            *string                       `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"`
+	File             []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"`
+	XXX_unrecognized []byte                        `json:"-"`
 }
 
 func (this *CodeGeneratorResponse) Reset()         { *this = CodeGeneratorResponse{} }
 func (this *CodeGeneratorResponse) String() string { return proto.CompactTextString(this) }
 func (*CodeGeneratorResponse) ProtoMessage()       {}
 
+func (this *CodeGeneratorResponse) GetError() string {
+	if this != nil && this.Error != nil {
+		return *this.Error
+	}
+	return ""
+}
+
 type CodeGeneratorResponse_File struct {
-	Name             *string `protobuf:"bytes,1,opt,name=name"`
-	InsertionPoint   *string `protobuf:"bytes,2,opt,name=insertion_point"`
-	Content          *string `protobuf:"bytes,15,opt,name=content"`
-	XXX_unrecognized []byte
+	Name             *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	InsertionPoint   *string `protobuf:"bytes,2,opt,name=insertion_point" json:"insertion_point,omitempty"`
+	Content          *string `protobuf:"bytes,15,opt,name=content" json:"content,omitempty"`
+	XXX_unrecognized []byte  `json:"-"`
 }
 
 func (this *CodeGeneratorResponse_File) Reset()         { *this = CodeGeneratorResponse_File{} }
 func (this *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(this) }
 func (*CodeGeneratorResponse_File) ProtoMessage()       {}
 
+func (this *CodeGeneratorResponse_File) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *CodeGeneratorResponse_File) GetInsertionPoint() string {
+	if this != nil && this.InsertionPoint != nil {
+		return *this.InsertionPoint
+	}
+	return ""
+}
+
+func (this *CodeGeneratorResponse_File) GetContent() string {
+	if this != nil && this.Content != nil {
+		return *this.Content
+	}
+	return ""
+}
+
 func init() {
 }

+ 57 - 22
protoc-gen-go/plugin/plugin.pb.golden

@@ -5,43 +5,78 @@ package google_protobuf_compiler
 
 import proto "code.google.com/p/goprotobuf/proto"
 import "math"
-import "os"
-import google_protobuf "code.google.com/p/goprotobuf/compiler/descriptor"
+import google_protobuf "code.google.com/p/goprotobuf/protoc-gen-go/descriptor"
 
-// Reference proto, math & os imports to suppress error if they are not otherwise used.
+// Reference proto and math imports to suppress error if they are not otherwise used.
 var _ = proto.GetString
 var _ = math.Inf
-var _ os.Error
-
 
 type CodeGeneratorRequest struct {
-	FileToGenerate		[]string				`protobuf:"bytes,1,rep,name=file_to_generate"`
-	Parameter		*string					`protobuf:"bytes,2,opt,name=parameter"`
-	ProtoFile		[]*google_protobuf.FileDescriptorProto	`protobuf:"bytes,15,rep,name=proto_file"`
-	XXX_unrecognized	[]byte
+	FileToGenerate   []string                               `protobuf:"bytes,1,rep,name=file_to_generate" json:"file_to_generate,omitempty"`
+	Parameter        *string                                `protobuf:"bytes,2,opt,name=parameter" json:"parameter,omitempty"`
+	ProtoFile        []*google_protobuf.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file" json:"proto_file,omitempty"`
+	XXX_unrecognized []byte                                 `json:"-"`
 }
 
-func (this *CodeGeneratorRequest) Reset()		{ *this = CodeGeneratorRequest{} }
-func (this *CodeGeneratorRequest) String() string	{ return proto.CompactTextString(this) }
+func (this *CodeGeneratorRequest) Reset()         { *this = CodeGeneratorRequest{} }
+func (this *CodeGeneratorRequest) String() string { return proto.CompactTextString(this) }
+func (*CodeGeneratorRequest) ProtoMessage()       {}
+
+func (this *CodeGeneratorRequest) GetParameter() string {
+	if this != nil && this.Parameter != nil {
+		return *this.Parameter
+	}
+	return ""
+}
 
 type CodeGeneratorResponse struct {
-	Error			*string				`protobuf:"bytes,1,opt,name=error"`
-	File			[]*CodeGeneratorResponse_File	`protobuf:"bytes,15,rep,name=file"`
-	XXX_unrecognized	[]byte
+	Error            *string                       `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"`
+	File             []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"`
+	XXX_unrecognized []byte                        `json:"-"`
 }
 
-func (this *CodeGeneratorResponse) Reset()		{ *this = CodeGeneratorResponse{} }
-func (this *CodeGeneratorResponse) String() string	{ return proto.CompactTextString(this) }
+func (this *CodeGeneratorResponse) Reset()         { *this = CodeGeneratorResponse{} }
+func (this *CodeGeneratorResponse) String() string { return proto.CompactTextString(this) }
+func (*CodeGeneratorResponse) ProtoMessage()       {}
+
+func (this *CodeGeneratorResponse) GetError() string {
+	if this != nil && this.Error != nil {
+		return *this.Error
+	}
+	return ""
+}
 
 type CodeGeneratorResponse_File struct {
-	Name			*string	`protobuf:"bytes,1,opt,name=name"`
-	InsertionPoint		*string	`protobuf:"bytes,2,opt,name=insertion_point"`
-	Content			*string	`protobuf:"bytes,15,opt,name=content"`
-	XXX_unrecognized	[]byte
+	Name             *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	InsertionPoint   *string `protobuf:"bytes,2,opt,name=insertion_point" json:"insertion_point,omitempty"`
+	Content          *string `protobuf:"bytes,15,opt,name=content" json:"content,omitempty"`
+	XXX_unrecognized []byte  `json:"-"`
 }
 
-func (this *CodeGeneratorResponse_File) Reset()		{ *this = CodeGeneratorResponse_File{} }
-func (this *CodeGeneratorResponse_File) String() string	{ return proto.CompactTextString(this) }
+func (this *CodeGeneratorResponse_File) Reset()         { *this = CodeGeneratorResponse_File{} }
+func (this *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(this) }
+func (*CodeGeneratorResponse_File) ProtoMessage()       {}
+
+func (this *CodeGeneratorResponse_File) GetName() string {
+	if this != nil && this.Name != nil {
+		return *this.Name
+	}
+	return ""
+}
+
+func (this *CodeGeneratorResponse_File) GetInsertionPoint() string {
+	if this != nil && this.InsertionPoint != nil {
+		return *this.InsertionPoint
+	}
+	return ""
+}
+
+func (this *CodeGeneratorResponse_File) GetContent() string {
+	if this != nil && this.Content != nil {
+		return *this.Content
+	}
+	return ""
+}
 
 func init() {
 }

+ 63 - 0
protoc-gen-go/testdata/my_test/test.pb.go

@@ -156,6 +156,41 @@ const Default_Request_Hat HatType = HatType_FEDORA
 
 var Default_Request_Deadline float32 = float32(math.Inf(1))
 
+func (this *Request) GetHue() Request_Color {
+	if this != nil && this.Hue != nil {
+		return *this.Hue
+	}
+	return 0
+}
+
+func (this *Request) GetHat() HatType {
+	if this != nil && this.Hat != nil {
+		return *this.Hat
+	}
+	return Default_Request_Hat
+}
+
+func (this *Request) GetDeadline() float32 {
+	if this != nil && this.Deadline != nil {
+		return *this.Deadline
+	}
+	return Default_Request_Deadline
+}
+
+func (this *Request) GetSomegroup() *Request_SomeGroup {
+	if this != nil {
+		return this.Somegroup
+	}
+	return nil
+}
+
+func (this *Request) GetReset_() int32 {
+	if this != nil && this.Reset_ != nil {
+		return *this.Reset_
+	}
+	return 0
+}
+
 type Request_SomeGroup struct {
 	GroupField       *int32 `protobuf:"varint,9,opt,name=group_field" json:"group_field,omitempty"`
 	XXX_unrecognized []byte `json:"-"`
@@ -165,6 +200,13 @@ func (this *Request_SomeGroup) Reset()         { *this = Request_SomeGroup{} }
 func (this *Request_SomeGroup) String() string { return proto.CompactTextString(this) }
 func (*Request_SomeGroup) ProtoMessage()       {}
 
+func (this *Request_SomeGroup) GetGroupField() int32 {
+	if this != nil && this.GroupField != nil {
+		return *this.GroupField
+	}
+	return 0
+}
+
 type Reply struct {
 	Found            []*Reply_Entry            `protobuf:"bytes,1,rep,name=found" json:"found,omitempty"`
 	CompactKeys      []int32                   `protobuf:"varint,2,rep,packed,name=compact_keys" json:"compact_keys,omitempty"`
@@ -203,6 +245,27 @@ func (*Reply_Entry) ProtoMessage()       {}
 
 const Default_Reply_Entry_Value int64 = 7
 
+func (this *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 {
+	if this != nil && this.KeyThatNeeds_1234Camel_CasIng != nil {
+		return *this.KeyThatNeeds_1234Camel_CasIng
+	}
+	return 0
+}
+
+func (this *Reply_Entry) GetValue() int64 {
+	if this != nil && this.Value != nil {
+		return *this.Value
+	}
+	return Default_Reply_Entry_Value
+}
+
+func (this *Reply_Entry) GetXMyFieldName_2() int64 {
+	if this != nil && this.XMyFieldName_2 != nil {
+		return *this.XMyFieldName_2
+	}
+	return 0
+}
+
 type ReplyExtensions struct {
 	XXX_unrecognized []byte `json:"-"`
 }

+ 63 - 0
protoc-gen-go/testdata/my_test/test.pb.go.golden

@@ -156,6 +156,41 @@ const Default_Request_Hat HatType = HatType_FEDORA
 
 var Default_Request_Deadline float32 = float32(math.Inf(1))
 
+func (this *Request) GetHue() Request_Color {
+	if this != nil && this.Hue != nil {
+		return *this.Hue
+	}
+	return 0
+}
+
+func (this *Request) GetHat() HatType {
+	if this != nil && this.Hat != nil {
+		return *this.Hat
+	}
+	return Default_Request_Hat
+}
+
+func (this *Request) GetDeadline() float32 {
+	if this != nil && this.Deadline != nil {
+		return *this.Deadline
+	}
+	return Default_Request_Deadline
+}
+
+func (this *Request) GetSomegroup() *Request_SomeGroup {
+	if this != nil {
+		return this.Somegroup
+	}
+	return nil
+}
+
+func (this *Request) GetReset_() int32 {
+	if this != nil && this.Reset_ != nil {
+		return *this.Reset_
+	}
+	return 0
+}
+
 type Request_SomeGroup struct {
 	GroupField       *int32 `protobuf:"varint,9,opt,name=group_field" json:"group_field,omitempty"`
 	XXX_unrecognized []byte `json:"-"`
@@ -165,6 +200,13 @@ func (this *Request_SomeGroup) Reset()         { *this = Request_SomeGroup{} }
 func (this *Request_SomeGroup) String() string { return proto.CompactTextString(this) }
 func (*Request_SomeGroup) ProtoMessage()       {}
 
+func (this *Request_SomeGroup) GetGroupField() int32 {
+	if this != nil && this.GroupField != nil {
+		return *this.GroupField
+	}
+	return 0
+}
+
 type Reply struct {
 	Found            []*Reply_Entry            `protobuf:"bytes,1,rep,name=found" json:"found,omitempty"`
 	CompactKeys      []int32                   `protobuf:"varint,2,rep,packed,name=compact_keys" json:"compact_keys,omitempty"`
@@ -203,6 +245,27 @@ func (*Reply_Entry) ProtoMessage()       {}
 
 const Default_Reply_Entry_Value int64 = 7
 
+func (this *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 {
+	if this != nil && this.KeyThatNeeds_1234Camel_CasIng != nil {
+		return *this.KeyThatNeeds_1234Camel_CasIng
+	}
+	return 0
+}
+
+func (this *Reply_Entry) GetValue() int64 {
+	if this != nil && this.Value != nil {
+		return *this.Value
+	}
+	return Default_Reply_Entry_Value
+}
+
+func (this *Reply_Entry) GetXMyFieldName_2() int64 {
+	if this != nil && this.XMyFieldName_2 != nil {
+		return *this.XMyFieldName_2
+	}
+	return 0
+}
+
 type ReplyExtensions struct {
 	XXX_unrecognized []byte `json:"-"`
 }