Ver código fonte

goprotobuf: Changes for new struct tag format.

Protocol messages have changed their struct tags from
  "PB(...)"
to
  `protobuf:"..."`
The format represented by "..." is unchanged.

Regenerate {descriptor,plugin}.pb.go files at the same time.

R=r, rsc
CC=golang-dev
http://codereview.appspot.com/4654077
David Symonds 14 anos atrás
pai
commit
8935abf8b1

+ 241 - 227
compiler/descriptor/descriptor.pb.go

@@ -12,37 +12,40 @@ var _ = proto.GetString
 var _ = math.Inf
 var _ os.Error
 
+
 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_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_SINT32   = 17
+	FieldDescriptorProto_TYPE_SINT64   = 18
 )
-var FieldDescriptorProto_Type_name = map[int32] string {
-	1: "TYPE_DOUBLE",
-	2: "TYPE_FLOAT",
-	3: "TYPE_INT64",
-	4: "TYPE_UINT64",
-	5: "TYPE_INT32",
-	6: "TYPE_FIXED64",
-	7: "TYPE_FIXED32",
-	8: "TYPE_BOOL",
-	9: "TYPE_STRING",
+
+var FieldDescriptorProto_Type_name = map[int32]string{
+	1:  "TYPE_DOUBLE",
+	2:  "TYPE_FLOAT",
+	3:  "TYPE_INT64",
+	4:  "TYPE_UINT64",
+	5:  "TYPE_INT32",
+	6:  "TYPE_FIXED64",
+	7:  "TYPE_FIXED32",
+	8:  "TYPE_BOOL",
+	9:  "TYPE_STRING",
 	10: "TYPE_GROUP",
 	11: "TYPE_MESSAGE",
 	12: "TYPE_BYTES",
@@ -53,218 +56,239 @@ var FieldDescriptorProto_Type_name = map[int32] string {
 	17: "TYPE_SINT32",
 	18: "TYPE_SINT64",
 }
-var FieldDescriptorProto_Type_value = map[string] int32 {
-	"TYPE_DOUBLE": 1,
-	"TYPE_FLOAT": 2,
-	"TYPE_INT64": 3,
-	"TYPE_UINT64": 4,
-	"TYPE_INT32": 5,
-	"TYPE_FIXED64": 6,
-	"TYPE_FIXED32": 7,
-	"TYPE_BOOL": 8,
-	"TYPE_STRING": 9,
-	"TYPE_GROUP": 10,
-	"TYPE_MESSAGE": 11,
-	"TYPE_BYTES": 12,
-	"TYPE_UINT32": 13,
-	"TYPE_ENUM": 14,
+var FieldDescriptorProto_Type_value = map[string]int32{
+	"TYPE_DOUBLE":   1,
+	"TYPE_FLOAT":    2,
+	"TYPE_INT64":    3,
+	"TYPE_UINT64":   4,
+	"TYPE_INT32":    5,
+	"TYPE_FIXED64":  6,
+	"TYPE_FIXED32":  7,
+	"TYPE_BOOL":     8,
+	"TYPE_STRING":   9,
+	"TYPE_GROUP":    10,
+	"TYPE_MESSAGE":  11,
+	"TYPE_BYTES":    12,
+	"TYPE_UINT32":   13,
+	"TYPE_ENUM":     14,
 	"TYPE_SFIXED32": 15,
 	"TYPE_SFIXED64": 16,
-	"TYPE_SINT32": 17,
-	"TYPE_SINT64": 18,
+	"TYPE_SINT32":   17,
+	"TYPE_SINT64":   18,
 }
+
 func NewFieldDescriptorProto_Type(x int32) *FieldDescriptorProto_Type {
 	e := FieldDescriptorProto_Type(x)
 	return &e
 }
+func (x FieldDescriptorProto_Type) String() string {
+	return proto.EnumName(FieldDescriptorProto_Type_name, int32(x))
+}
 
 type FieldDescriptorProto_Label int32
+
 const (
 	FieldDescriptorProto_LABEL_OPTIONAL = 1
 	FieldDescriptorProto_LABEL_REQUIRED = 2
 	FieldDescriptorProto_LABEL_REPEATED = 3
 )
-var FieldDescriptorProto_Label_name = map[int32] string {
+
+var FieldDescriptorProto_Label_name = map[int32]string{
 	1: "LABEL_OPTIONAL",
 	2: "LABEL_REQUIRED",
 	3: "LABEL_REPEATED",
 }
-var FieldDescriptorProto_Label_value = map[string] int32 {
+var FieldDescriptorProto_Label_value = map[string]int32{
 	"LABEL_OPTIONAL": 1,
 	"LABEL_REQUIRED": 2,
 	"LABEL_REPEATED": 3,
 }
+
 func NewFieldDescriptorProto_Label(x int32) *FieldDescriptorProto_Label {
 	e := FieldDescriptorProto_Label(x)
 	return &e
 }
+func (x FieldDescriptorProto_Label) String() string {
+	return proto.EnumName(FieldDescriptorProto_Label_name, int32(x))
+}
 
 type FileOptions_OptimizeMode int32
+
 const (
-	FileOptions_SPEED = 1
-	FileOptions_CODE_SIZE = 2
+	FileOptions_SPEED        = 1
+	FileOptions_CODE_SIZE    = 2
 	FileOptions_LITE_RUNTIME = 3
 )
-var FileOptions_OptimizeMode_name = map[int32] string {
+
+var FileOptions_OptimizeMode_name = map[int32]string{
 	1: "SPEED",
 	2: "CODE_SIZE",
 	3: "LITE_RUNTIME",
 }
-var FileOptions_OptimizeMode_value = map[string] int32 {
-	"SPEED": 1,
-	"CODE_SIZE": 2,
+var FileOptions_OptimizeMode_value = map[string]int32{
+	"SPEED":        1,
+	"CODE_SIZE":    2,
 	"LITE_RUNTIME": 3,
 }
+
 func NewFileOptions_OptimizeMode(x int32) *FileOptions_OptimizeMode {
 	e := FileOptions_OptimizeMode(x)
 	return &e
 }
+func (x FileOptions_OptimizeMode) String() string {
+	return proto.EnumName(FileOptions_OptimizeMode_name, int32(x))
+}
 
 type FieldOptions_CType int32
+
 const (
-	FieldOptions_STRING = 0
-	FieldOptions_CORD = 1
+	FieldOptions_STRING       = 0
+	FieldOptions_CORD         = 1
 	FieldOptions_STRING_PIECE = 2
 )
-var FieldOptions_CType_name = map[int32] string {
+
+var FieldOptions_CType_name = map[int32]string{
 	0: "STRING",
 	1: "CORD",
 	2: "STRING_PIECE",
 }
-var FieldOptions_CType_value = map[string] int32 {
-	"STRING": 0,
-	"CORD": 1,
+var FieldOptions_CType_value = map[string]int32{
+	"STRING":       0,
+	"CORD":         1,
 	"STRING_PIECE": 2,
 }
+
 func NewFieldOptions_CType(x int32) *FieldOptions_CType {
 	e := FieldOptions_CType(x)
 	return &e
 }
+func (x FieldOptions_CType) String() string {
+	return proto.EnumName(FieldOptions_CType_name, int32(x))
+}
 
 type FileDescriptorSet struct {
-	File	[]*FileDescriptorProto	"PB(bytes,1,rep,name=file)"
-	XXX_unrecognized	[]byte
-}
-func (this *FileDescriptorSet) Reset() {
-	*this = FileDescriptorSet{}
+	File             []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file"`
+	XXX_unrecognized []byte
 }
 
+func (this *FileDescriptorSet) Reset()         { *this = FileDescriptorSet{} }
+func (this *FileDescriptorSet) String() string { return proto.CompactTextString(this) }
+
 type FileDescriptorProto struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	Package	*string	"PB(bytes,2,opt,name=package)"
-	Dependency	[]string	"PB(bytes,3,rep,name=dependency)"
-	PublicDependency	[]int32	"PB(varint,10,rep,name=public_dependency)"
-	MessageType	[]*DescriptorProto	"PB(bytes,4,rep,name=message_type)"
-	EnumType	[]*EnumDescriptorProto	"PB(bytes,5,rep,name=enum_type)"
-	Service	[]*ServiceDescriptorProto	"PB(bytes,6,rep,name=service)"
-	Extension	[]*FieldDescriptorProto	"PB(bytes,7,rep,name=extension)"
-	Options	*FileOptions	"PB(bytes,8,opt,name=options)"
-	SourceCodeInfo	*SourceCodeInfo	"PB(bytes,9,opt,name=source_code_info)"
-	XXX_unrecognized	[]byte
-}
-func (this *FileDescriptorProto) Reset() {
-	*this = FileDescriptorProto{}
+	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"`
+	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
 }
 
+func (this *FileDescriptorProto) Reset()         { *this = FileDescriptorProto{} }
+func (this *FileDescriptorProto) String() string { return proto.CompactTextString(this) }
+
 type DescriptorProto struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	Field	[]*FieldDescriptorProto	"PB(bytes,2,rep,name=field)"
-	Extension	[]*FieldDescriptorProto	"PB(bytes,6,rep,name=extension)"
-	NestedType	[]*DescriptorProto	"PB(bytes,3,rep,name=nested_type)"
-	EnumType	[]*EnumDescriptorProto	"PB(bytes,4,rep,name=enum_type)"
-	ExtensionRange	[]*DescriptorProto_ExtensionRange	"PB(bytes,5,rep,name=extension_range)"
-	Options	*MessageOptions	"PB(bytes,7,opt,name=options)"
-	XXX_unrecognized	[]byte
-}
-func (this *DescriptorProto) Reset() {
-	*this = DescriptorProto{}
+	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
 }
 
+func (this *DescriptorProto) Reset()         { *this = DescriptorProto{} }
+func (this *DescriptorProto) String() string { return proto.CompactTextString(this) }
+
 type DescriptorProto_ExtensionRange struct {
-	Start	*int32	"PB(varint,1,opt,name=start)"
-	End	*int32	"PB(varint,2,opt,name=end)"
-	XXX_unrecognized	[]byte
-}
-func (this *DescriptorProto_ExtensionRange) Reset() {
-	*this = DescriptorProto_ExtensionRange{}
+	Start            *int32 `protobuf:"varint,1,opt,name=start"`
+	End              *int32 `protobuf:"varint,2,opt,name=end"`
+	XXX_unrecognized []byte
 }
 
+func (this *DescriptorProto_ExtensionRange) Reset()         { *this = DescriptorProto_ExtensionRange{} }
+func (this *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(this) }
+
 type FieldDescriptorProto struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	Number	*int32	"PB(varint,3,opt,name=number)"
-	Label	*FieldDescriptorProto_Label	"PB(varint,4,opt,name=label,enum=google_protobuf.FieldDescriptorProto_Label)"
-	Type	*FieldDescriptorProto_Type	"PB(varint,5,opt,name=type,enum=google_protobuf.FieldDescriptorProto_Type)"
-	TypeName	*string	"PB(bytes,6,opt,name=type_name)"
-	Extendee	*string	"PB(bytes,2,opt,name=extendee)"
-	DefaultValue	*string	"PB(bytes,7,opt,name=default_value)"
-	Options	*FieldOptions	"PB(bytes,8,opt,name=options)"
-	XXX_unrecognized	[]byte
-}
-func (this *FieldDescriptorProto) Reset() {
-	*this = FieldDescriptorProto{}
+	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
 }
 
+func (this *FieldDescriptorProto) Reset()         { *this = FieldDescriptorProto{} }
+func (this *FieldDescriptorProto) String() string { return proto.CompactTextString(this) }
+
 type EnumDescriptorProto struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	Value	[]*EnumValueDescriptorProto	"PB(bytes,2,rep,name=value)"
-	Options	*EnumOptions	"PB(bytes,3,opt,name=options)"
-	XXX_unrecognized	[]byte
-}
-func (this *EnumDescriptorProto) Reset() {
-	*this = EnumDescriptorProto{}
+	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
 }
 
+func (this *EnumDescriptorProto) Reset()         { *this = EnumDescriptorProto{} }
+func (this *EnumDescriptorProto) String() string { return proto.CompactTextString(this) }
+
 type EnumValueDescriptorProto struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	Number	*int32	"PB(varint,2,opt,name=number)"
-	Options	*EnumValueOptions	"PB(bytes,3,opt,name=options)"
-	XXX_unrecognized	[]byte
-}
-func (this *EnumValueDescriptorProto) Reset() {
-	*this = EnumValueDescriptorProto{}
+	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
 }
 
+func (this *EnumValueDescriptorProto) Reset()         { *this = EnumValueDescriptorProto{} }
+func (this *EnumValueDescriptorProto) String() string { return proto.CompactTextString(this) }
+
 type ServiceDescriptorProto struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	Method	[]*MethodDescriptorProto	"PB(bytes,2,rep,name=method)"
-	Options	*ServiceOptions	"PB(bytes,3,opt,name=options)"
-	XXX_unrecognized	[]byte
-}
-func (this *ServiceDescriptorProto) Reset() {
-	*this = ServiceDescriptorProto{}
+	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
 }
 
+func (this *ServiceDescriptorProto) Reset()         { *this = ServiceDescriptorProto{} }
+func (this *ServiceDescriptorProto) String() string { return proto.CompactTextString(this) }
+
 type MethodDescriptorProto struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	InputType	*string	"PB(bytes,2,opt,name=input_type)"
-	OutputType	*string	"PB(bytes,3,opt,name=output_type)"
-	Options	*MethodOptions	"PB(bytes,4,opt,name=options)"
-	XXX_unrecognized	[]byte
-}
-func (this *MethodDescriptorProto) Reset() {
-	*this = MethodDescriptorProto{}
+	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
 }
 
+func (this *MethodDescriptorProto) Reset()         { *this = MethodDescriptorProto{} }
+func (this *MethodDescriptorProto) String() string { return proto.CompactTextString(this) }
+
 type FileOptions struct {
-	JavaPackage	*string	"PB(bytes,1,opt,name=java_package)"
-	JavaOuterClassname	*string	"PB(bytes,8,opt,name=java_outer_classname)"
-	JavaMultipleFiles	*bool	"PB(varint,10,opt,name=java_multiple_files,def=0)"
-	JavaGenerateEqualsAndHash	*bool	"PB(varint,20,opt,name=java_generate_equals_and_hash,def=0)"
-	OptimizeFor	*FileOptions_OptimizeMode	"PB(varint,9,opt,name=optimize_for,enum=google_protobuf.FileOptions_OptimizeMode,def=1)"
-	CcGenericServices	*bool	"PB(varint,16,opt,name=cc_generic_services,def=0)"
-	JavaGenericServices	*bool	"PB(varint,17,opt,name=java_generic_services,def=0)"
-	PyGenericServices	*bool	"PB(varint,18,opt,name=py_generic_services,def=0)"
-	UninterpretedOption	[]*UninterpretedOption	"PB(bytes,999,rep,name=uninterpreted_option)"
-	XXX_extensions		map[int32][]byte
-	XXX_unrecognized	[]byte
-}
-func (this *FileOptions) Reset() {
-	*this = FileOptions{}
+	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
 }
 
+func (this *FileOptions) Reset()         { *this = FileOptions{} }
+func (this *FileOptions) String() string { return proto.CompactTextString(this) }
+
 var extRange_FileOptions = []proto.ExtensionRange{
 	proto.ExtensionRange{1000, 536870911},
 }
+
 func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_FileOptions
 }
@@ -274,27 +298,28 @@ func (this *FileOptions) ExtensionMap() map[int32][]byte {
 	}
 	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 = false
-const Default_FileOptions_JavaGenericServices bool = false
-const Default_FileOptions_PyGenericServices bool = false
+const Default_FileOptions_CcGenericServices bool = true
+const Default_FileOptions_JavaGenericServices bool = true
+const Default_FileOptions_PyGenericServices bool = true
 
 type MessageOptions struct {
-	MessageSetWireFormat	*bool	"PB(varint,1,opt,name=message_set_wire_format,def=0)"
-	NoStandardDescriptorAccessor	*bool	"PB(varint,2,opt,name=no_standard_descriptor_accessor,def=0)"
-	UninterpretedOption	[]*UninterpretedOption	"PB(bytes,999,rep,name=uninterpreted_option)"
-	XXX_extensions		map[int32][]byte
-	XXX_unrecognized	[]byte
-}
-func (this *MessageOptions) Reset() {
-	*this = MessageOptions{}
+	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
 }
 
+func (this *MessageOptions) Reset()         { *this = MessageOptions{} }
+func (this *MessageOptions) String() string { return proto.CompactTextString(this) }
+
 var extRange_MessageOptions = []proto.ExtensionRange{
 	proto.ExtensionRange{1000, 536870911},
 }
+
 func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_MessageOptions
 }
@@ -304,25 +329,27 @@ func (this *MessageOptions) ExtensionMap() map[int32][]byte {
 	}
 	return this.XXX_extensions
 }
+
 const Default_MessageOptions_MessageSetWireFormat bool = false
 const Default_MessageOptions_NoStandardDescriptorAccessor bool = false
 
 type FieldOptions struct {
-	Ctype	*FieldOptions_CType	"PB(varint,1,opt,name=ctype,enum=google_protobuf.FieldOptions_CType,def=0)"
-	Packed	*bool	"PB(varint,2,opt,name=packed)"
-	Deprecated	*bool	"PB(varint,3,opt,name=deprecated,def=0)"
-	ExperimentalMapKey	*string	"PB(bytes,9,opt,name=experimental_map_key)"
-	UninterpretedOption	[]*UninterpretedOption	"PB(bytes,999,rep,name=uninterpreted_option)"
-	XXX_extensions		map[int32][]byte
-	XXX_unrecognized	[]byte
-}
-func (this *FieldOptions) Reset() {
-	*this = FieldOptions{}
+	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"`
+	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
+	XXX_extensions      map[int32][]byte
+	XXX_unrecognized    []byte
 }
 
+func (this *FieldOptions) Reset()         { *this = FieldOptions{} }
+func (this *FieldOptions) String() string { return proto.CompactTextString(this) }
+
 var extRange_FieldOptions = []proto.ExtensionRange{
 	proto.ExtensionRange{1000, 536870911},
 }
+
 func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_FieldOptions
 }
@@ -332,21 +359,23 @@ func (this *FieldOptions) ExtensionMap() map[int32][]byte {
 	}
 	return this.XXX_extensions
 }
+
 const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING
 const Default_FieldOptions_Deprecated bool = false
 
 type EnumOptions struct {
-	UninterpretedOption	[]*UninterpretedOption	"PB(bytes,999,rep,name=uninterpreted_option)"
-	XXX_extensions		map[int32][]byte
-	XXX_unrecognized	[]byte
-}
-func (this *EnumOptions) Reset() {
-	*this = EnumOptions{}
+	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
+	XXX_extensions      map[int32][]byte
+	XXX_unrecognized    []byte
 }
 
+func (this *EnumOptions) Reset()         { *this = EnumOptions{} }
+func (this *EnumOptions) String() string { return proto.CompactTextString(this) }
+
 var extRange_EnumOptions = []proto.ExtensionRange{
 	proto.ExtensionRange{1000, 536870911},
 }
+
 func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_EnumOptions
 }
@@ -358,17 +387,18 @@ func (this *EnumOptions) ExtensionMap() map[int32][]byte {
 }
 
 type EnumValueOptions struct {
-	UninterpretedOption	[]*UninterpretedOption	"PB(bytes,999,rep,name=uninterpreted_option)"
-	XXX_extensions		map[int32][]byte
-	XXX_unrecognized	[]byte
-}
-func (this *EnumValueOptions) Reset() {
-	*this = EnumValueOptions{}
+	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
+	XXX_extensions      map[int32][]byte
+	XXX_unrecognized    []byte
 }
 
+func (this *EnumValueOptions) Reset()         { *this = EnumValueOptions{} }
+func (this *EnumValueOptions) String() string { return proto.CompactTextString(this) }
+
 var extRange_EnumValueOptions = []proto.ExtensionRange{
 	proto.ExtensionRange{1000, 536870911},
 }
+
 func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_EnumValueOptions
 }
@@ -380,17 +410,18 @@ func (this *EnumValueOptions) ExtensionMap() map[int32][]byte {
 }
 
 type ServiceOptions struct {
-	UninterpretedOption	[]*UninterpretedOption	"PB(bytes,999,rep,name=uninterpreted_option)"
-	XXX_extensions		map[int32][]byte
-	XXX_unrecognized	[]byte
-}
-func (this *ServiceOptions) Reset() {
-	*this = ServiceOptions{}
+	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
+	XXX_extensions      map[int32][]byte
+	XXX_unrecognized    []byte
 }
 
+func (this *ServiceOptions) Reset()         { *this = ServiceOptions{} }
+func (this *ServiceOptions) String() string { return proto.CompactTextString(this) }
+
 var extRange_ServiceOptions = []proto.ExtensionRange{
 	proto.ExtensionRange{1000, 536870911},
 }
+
 func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_ServiceOptions
 }
@@ -402,17 +433,18 @@ func (this *ServiceOptions) ExtensionMap() map[int32][]byte {
 }
 
 type MethodOptions struct {
-	UninterpretedOption	[]*UninterpretedOption	"PB(bytes,999,rep,name=uninterpreted_option)"
-	XXX_extensions		map[int32][]byte
-	XXX_unrecognized	[]byte
-}
-func (this *MethodOptions) Reset() {
-	*this = MethodOptions{}
+	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
+	XXX_extensions      map[int32][]byte
+	XXX_unrecognized    []byte
 }
 
+func (this *MethodOptions) Reset()         { *this = MethodOptions{} }
+func (this *MethodOptions) String() string { return proto.CompactTextString(this) }
+
 var extRange_MethodOptions = []proto.ExtensionRange{
 	proto.ExtensionRange{1000, 536870911},
 }
+
 func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_MethodOptions
 }
@@ -424,44 +456,26 @@ func (this *MethodOptions) ExtensionMap() map[int32][]byte {
 }
 
 type UninterpretedOption struct {
-	Name	[]*UninterpretedOption_NamePart	"PB(bytes,2,rep,name=name)"
-	IdentifierValue	*string	"PB(bytes,3,opt,name=identifier_value)"
-	PositiveIntValue	*uint64	"PB(varint,4,opt,name=positive_int_value)"
-	NegativeIntValue	*int64	"PB(varint,5,opt,name=negative_int_value)"
-	DoubleValue	*float64	"PB(fixed64,6,opt,name=double_value)"
-	StringValue	[]byte	"PB(bytes,7,opt,name=string_value)"
-	AggregateValue	*string	"PB(bytes,8,opt,name=aggregate_value)"
-	XXX_unrecognized	[]byte
-}
-func (this *UninterpretedOption) Reset() {
-	*this = UninterpretedOption{}
+	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
 }
 
-type UninterpretedOption_NamePart struct {
-	NamePart	*string	"PB(bytes,1,req,name=name_part)"
-	IsExtension	*bool	"PB(varint,2,req,name=is_extension)"
-	XXX_unrecognized	[]byte
-}
-func (this *UninterpretedOption_NamePart) Reset() {
-	*this = UninterpretedOption_NamePart{}
-}
+func (this *UninterpretedOption) Reset()         { *this = UninterpretedOption{} }
+func (this *UninterpretedOption) String() string { return proto.CompactTextString(this) }
 
-type SourceCodeInfo struct {
-	Location	[]*SourceCodeInfo_Location	"PB(bytes,1,rep,name=location)"
-	XXX_unrecognized	[]byte
-}
-func (this *SourceCodeInfo) Reset() {
-	*this = SourceCodeInfo{}
+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
 }
 
-type SourceCodeInfo_Location struct {
-	Path	[]int32	"PB(varint,1,rep,packed,name=path)"
-	Span	[]int32	"PB(varint,2,rep,packed,name=span)"
-	XXX_unrecognized	[]byte
-}
-func (this *SourceCodeInfo_Location) Reset() {
-	*this = SourceCodeInfo_Location{}
-}
+func (this *UninterpretedOption_NamePart) Reset()         { *this = UninterpretedOption_NamePart{} }
+func (this *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(this) }
 
 func init() {
 	proto.RegisterEnum("google_protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value)

+ 241 - 227
compiler/descriptor/descriptor.pb.golden

@@ -12,37 +12,40 @@ var _ = proto.GetString
 var _ = math.Inf
 var _ os.Error
 
+
 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_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_SINT32   = 17
+	FieldDescriptorProto_TYPE_SINT64   = 18
 )
-var FieldDescriptorProto_Type_name = map[int32] string {
-	1: "TYPE_DOUBLE",
-	2: "TYPE_FLOAT",
-	3: "TYPE_INT64",
-	4: "TYPE_UINT64",
-	5: "TYPE_INT32",
-	6: "TYPE_FIXED64",
-	7: "TYPE_FIXED32",
-	8: "TYPE_BOOL",
-	9: "TYPE_STRING",
+
+var FieldDescriptorProto_Type_name = map[int32]string{
+	1:  "TYPE_DOUBLE",
+	2:  "TYPE_FLOAT",
+	3:  "TYPE_INT64",
+	4:  "TYPE_UINT64",
+	5:  "TYPE_INT32",
+	6:  "TYPE_FIXED64",
+	7:  "TYPE_FIXED32",
+	8:  "TYPE_BOOL",
+	9:  "TYPE_STRING",
 	10: "TYPE_GROUP",
 	11: "TYPE_MESSAGE",
 	12: "TYPE_BYTES",
@@ -53,218 +56,239 @@ var FieldDescriptorProto_Type_name = map[int32] string {
 	17: "TYPE_SINT32",
 	18: "TYPE_SINT64",
 }
-var FieldDescriptorProto_Type_value = map[string] int32 {
-	"TYPE_DOUBLE": 1,
-	"TYPE_FLOAT": 2,
-	"TYPE_INT64": 3,
-	"TYPE_UINT64": 4,
-	"TYPE_INT32": 5,
-	"TYPE_FIXED64": 6,
-	"TYPE_FIXED32": 7,
-	"TYPE_BOOL": 8,
-	"TYPE_STRING": 9,
-	"TYPE_GROUP": 10,
-	"TYPE_MESSAGE": 11,
-	"TYPE_BYTES": 12,
-	"TYPE_UINT32": 13,
-	"TYPE_ENUM": 14,
+var FieldDescriptorProto_Type_value = map[string]int32{
+	"TYPE_DOUBLE":   1,
+	"TYPE_FLOAT":    2,
+	"TYPE_INT64":    3,
+	"TYPE_UINT64":   4,
+	"TYPE_INT32":    5,
+	"TYPE_FIXED64":  6,
+	"TYPE_FIXED32":  7,
+	"TYPE_BOOL":     8,
+	"TYPE_STRING":   9,
+	"TYPE_GROUP":    10,
+	"TYPE_MESSAGE":  11,
+	"TYPE_BYTES":    12,
+	"TYPE_UINT32":   13,
+	"TYPE_ENUM":     14,
 	"TYPE_SFIXED32": 15,
 	"TYPE_SFIXED64": 16,
-	"TYPE_SINT32": 17,
-	"TYPE_SINT64": 18,
+	"TYPE_SINT32":   17,
+	"TYPE_SINT64":   18,
 }
+
 func NewFieldDescriptorProto_Type(x int32) *FieldDescriptorProto_Type {
 	e := FieldDescriptorProto_Type(x)
 	return &e
 }
+func (x FieldDescriptorProto_Type) String() string {
+	return proto.EnumName(FieldDescriptorProto_Type_name, int32(x))
+}
 
 type FieldDescriptorProto_Label int32
+
 const (
 	FieldDescriptorProto_LABEL_OPTIONAL = 1
 	FieldDescriptorProto_LABEL_REQUIRED = 2
 	FieldDescriptorProto_LABEL_REPEATED = 3
 )
-var FieldDescriptorProto_Label_name = map[int32] string {
+
+var FieldDescriptorProto_Label_name = map[int32]string{
 	1: "LABEL_OPTIONAL",
 	2: "LABEL_REQUIRED",
 	3: "LABEL_REPEATED",
 }
-var FieldDescriptorProto_Label_value = map[string] int32 {
+var FieldDescriptorProto_Label_value = map[string]int32{
 	"LABEL_OPTIONAL": 1,
 	"LABEL_REQUIRED": 2,
 	"LABEL_REPEATED": 3,
 }
+
 func NewFieldDescriptorProto_Label(x int32) *FieldDescriptorProto_Label {
 	e := FieldDescriptorProto_Label(x)
 	return &e
 }
+func (x FieldDescriptorProto_Label) String() string {
+	return proto.EnumName(FieldDescriptorProto_Label_name, int32(x))
+}
 
 type FileOptions_OptimizeMode int32
+
 const (
-	FileOptions_SPEED = 1
-	FileOptions_CODE_SIZE = 2
+	FileOptions_SPEED        = 1
+	FileOptions_CODE_SIZE    = 2
 	FileOptions_LITE_RUNTIME = 3
 )
-var FileOptions_OptimizeMode_name = map[int32] string {
+
+var FileOptions_OptimizeMode_name = map[int32]string{
 	1: "SPEED",
 	2: "CODE_SIZE",
 	3: "LITE_RUNTIME",
 }
-var FileOptions_OptimizeMode_value = map[string] int32 {
-	"SPEED": 1,
-	"CODE_SIZE": 2,
+var FileOptions_OptimizeMode_value = map[string]int32{
+	"SPEED":        1,
+	"CODE_SIZE":    2,
 	"LITE_RUNTIME": 3,
 }
+
 func NewFileOptions_OptimizeMode(x int32) *FileOptions_OptimizeMode {
 	e := FileOptions_OptimizeMode(x)
 	return &e
 }
+func (x FileOptions_OptimizeMode) String() string {
+	return proto.EnumName(FileOptions_OptimizeMode_name, int32(x))
+}
 
 type FieldOptions_CType int32
+
 const (
-	FieldOptions_STRING = 0
-	FieldOptions_CORD = 1
+	FieldOptions_STRING       = 0
+	FieldOptions_CORD         = 1
 	FieldOptions_STRING_PIECE = 2
 )
-var FieldOptions_CType_name = map[int32] string {
+
+var FieldOptions_CType_name = map[int32]string{
 	0: "STRING",
 	1: "CORD",
 	2: "STRING_PIECE",
 }
-var FieldOptions_CType_value = map[string] int32 {
-	"STRING": 0,
-	"CORD": 1,
+var FieldOptions_CType_value = map[string]int32{
+	"STRING":       0,
+	"CORD":         1,
 	"STRING_PIECE": 2,
 }
+
 func NewFieldOptions_CType(x int32) *FieldOptions_CType {
 	e := FieldOptions_CType(x)
 	return &e
 }
+func (x FieldOptions_CType) String() string {
+	return proto.EnumName(FieldOptions_CType_name, int32(x))
+}
 
 type FileDescriptorSet struct {
-	File	[]*FileDescriptorProto	"PB(bytes,1,rep,name=file)"
-	XXX_unrecognized	[]byte
-}
-func (this *FileDescriptorSet) Reset() {
-	*this = FileDescriptorSet{}
+	File             []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file"`
+	XXX_unrecognized []byte
 }
 
+func (this *FileDescriptorSet) Reset()         { *this = FileDescriptorSet{} }
+func (this *FileDescriptorSet) String() string { return proto.CompactTextString(this) }
+
 type FileDescriptorProto struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	Package	*string	"PB(bytes,2,opt,name=package)"
-	Dependency	[]string	"PB(bytes,3,rep,name=dependency)"
-	PublicDependency	[]int32	"PB(varint,10,rep,name=public_dependency)"
-	MessageType	[]*DescriptorProto	"PB(bytes,4,rep,name=message_type)"
-	EnumType	[]*EnumDescriptorProto	"PB(bytes,5,rep,name=enum_type)"
-	Service	[]*ServiceDescriptorProto	"PB(bytes,6,rep,name=service)"
-	Extension	[]*FieldDescriptorProto	"PB(bytes,7,rep,name=extension)"
-	Options	*FileOptions	"PB(bytes,8,opt,name=options)"
-	SourceCodeInfo	*SourceCodeInfo	"PB(bytes,9,opt,name=source_code_info)"
-	XXX_unrecognized	[]byte
-}
-func (this *FileDescriptorProto) Reset() {
-	*this = FileDescriptorProto{}
+	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"`
+	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
 }
 
+func (this *FileDescriptorProto) Reset()         { *this = FileDescriptorProto{} }
+func (this *FileDescriptorProto) String() string { return proto.CompactTextString(this) }
+
 type DescriptorProto struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	Field	[]*FieldDescriptorProto	"PB(bytes,2,rep,name=field)"
-	Extension	[]*FieldDescriptorProto	"PB(bytes,6,rep,name=extension)"
-	NestedType	[]*DescriptorProto	"PB(bytes,3,rep,name=nested_type)"
-	EnumType	[]*EnumDescriptorProto	"PB(bytes,4,rep,name=enum_type)"
-	ExtensionRange	[]*DescriptorProto_ExtensionRange	"PB(bytes,5,rep,name=extension_range)"
-	Options	*MessageOptions	"PB(bytes,7,opt,name=options)"
-	XXX_unrecognized	[]byte
-}
-func (this *DescriptorProto) Reset() {
-	*this = DescriptorProto{}
+	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
 }
 
+func (this *DescriptorProto) Reset()         { *this = DescriptorProto{} }
+func (this *DescriptorProto) String() string { return proto.CompactTextString(this) }
+
 type DescriptorProto_ExtensionRange struct {
-	Start	*int32	"PB(varint,1,opt,name=start)"
-	End	*int32	"PB(varint,2,opt,name=end)"
-	XXX_unrecognized	[]byte
-}
-func (this *DescriptorProto_ExtensionRange) Reset() {
-	*this = DescriptorProto_ExtensionRange{}
+	Start            *int32 `protobuf:"varint,1,opt,name=start"`
+	End              *int32 `protobuf:"varint,2,opt,name=end"`
+	XXX_unrecognized []byte
 }
 
+func (this *DescriptorProto_ExtensionRange) Reset()         { *this = DescriptorProto_ExtensionRange{} }
+func (this *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(this) }
+
 type FieldDescriptorProto struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	Number	*int32	"PB(varint,3,opt,name=number)"
-	Label	*FieldDescriptorProto_Label	"PB(varint,4,opt,name=label,enum=google_protobuf.FieldDescriptorProto_Label)"
-	Type	*FieldDescriptorProto_Type	"PB(varint,5,opt,name=type,enum=google_protobuf.FieldDescriptorProto_Type)"
-	TypeName	*string	"PB(bytes,6,opt,name=type_name)"
-	Extendee	*string	"PB(bytes,2,opt,name=extendee)"
-	DefaultValue	*string	"PB(bytes,7,opt,name=default_value)"
-	Options	*FieldOptions	"PB(bytes,8,opt,name=options)"
-	XXX_unrecognized	[]byte
-}
-func (this *FieldDescriptorProto) Reset() {
-	*this = FieldDescriptorProto{}
+	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
 }
 
+func (this *FieldDescriptorProto) Reset()         { *this = FieldDescriptorProto{} }
+func (this *FieldDescriptorProto) String() string { return proto.CompactTextString(this) }
+
 type EnumDescriptorProto struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	Value	[]*EnumValueDescriptorProto	"PB(bytes,2,rep,name=value)"
-	Options	*EnumOptions	"PB(bytes,3,opt,name=options)"
-	XXX_unrecognized	[]byte
-}
-func (this *EnumDescriptorProto) Reset() {
-	*this = EnumDescriptorProto{}
+	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
 }
 
+func (this *EnumDescriptorProto) Reset()         { *this = EnumDescriptorProto{} }
+func (this *EnumDescriptorProto) String() string { return proto.CompactTextString(this) }
+
 type EnumValueDescriptorProto struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	Number	*int32	"PB(varint,2,opt,name=number)"
-	Options	*EnumValueOptions	"PB(bytes,3,opt,name=options)"
-	XXX_unrecognized	[]byte
-}
-func (this *EnumValueDescriptorProto) Reset() {
-	*this = EnumValueDescriptorProto{}
+	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
 }
 
+func (this *EnumValueDescriptorProto) Reset()         { *this = EnumValueDescriptorProto{} }
+func (this *EnumValueDescriptorProto) String() string { return proto.CompactTextString(this) }
+
 type ServiceDescriptorProto struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	Method	[]*MethodDescriptorProto	"PB(bytes,2,rep,name=method)"
-	Options	*ServiceOptions	"PB(bytes,3,opt,name=options)"
-	XXX_unrecognized	[]byte
-}
-func (this *ServiceDescriptorProto) Reset() {
-	*this = ServiceDescriptorProto{}
+	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
 }
 
+func (this *ServiceDescriptorProto) Reset()         { *this = ServiceDescriptorProto{} }
+func (this *ServiceDescriptorProto) String() string { return proto.CompactTextString(this) }
+
 type MethodDescriptorProto struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	InputType	*string	"PB(bytes,2,opt,name=input_type)"
-	OutputType	*string	"PB(bytes,3,opt,name=output_type)"
-	Options	*MethodOptions	"PB(bytes,4,opt,name=options)"
-	XXX_unrecognized	[]byte
-}
-func (this *MethodDescriptorProto) Reset() {
-	*this = MethodDescriptorProto{}
+	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
 }
 
+func (this *MethodDescriptorProto) Reset()         { *this = MethodDescriptorProto{} }
+func (this *MethodDescriptorProto) String() string { return proto.CompactTextString(this) }
+
 type FileOptions struct {
-	JavaPackage	*string	"PB(bytes,1,opt,name=java_package)"
-	JavaOuterClassname	*string	"PB(bytes,8,opt,name=java_outer_classname)"
-	JavaMultipleFiles	*bool	"PB(varint,10,opt,name=java_multiple_files,def=0)"
-	JavaGenerateEqualsAndHash	*bool	"PB(varint,20,opt,name=java_generate_equals_and_hash,def=0)"
-	OptimizeFor	*FileOptions_OptimizeMode	"PB(varint,9,opt,name=optimize_for,enum=google_protobuf.FileOptions_OptimizeMode,def=1)"
-	CcGenericServices	*bool	"PB(varint,16,opt,name=cc_generic_services,def=0)"
-	JavaGenericServices	*bool	"PB(varint,17,opt,name=java_generic_services,def=0)"
-	PyGenericServices	*bool	"PB(varint,18,opt,name=py_generic_services,def=0)"
-	UninterpretedOption	[]*UninterpretedOption	"PB(bytes,999,rep,name=uninterpreted_option)"
-	XXX_extensions		map[int32][]byte
-	XXX_unrecognized	[]byte
-}
-func (this *FileOptions) Reset() {
-	*this = FileOptions{}
+	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
 }
 
+func (this *FileOptions) Reset()         { *this = FileOptions{} }
+func (this *FileOptions) String() string { return proto.CompactTextString(this) }
+
 var extRange_FileOptions = []proto.ExtensionRange{
 	proto.ExtensionRange{1000, 536870911},
 }
+
 func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_FileOptions
 }
@@ -274,27 +298,28 @@ func (this *FileOptions) ExtensionMap() map[int32][]byte {
 	}
 	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 = false
-const Default_FileOptions_JavaGenericServices bool = false
-const Default_FileOptions_PyGenericServices bool = false
+const Default_FileOptions_CcGenericServices bool = true
+const Default_FileOptions_JavaGenericServices bool = true
+const Default_FileOptions_PyGenericServices bool = true
 
 type MessageOptions struct {
-	MessageSetWireFormat	*bool	"PB(varint,1,opt,name=message_set_wire_format,def=0)"
-	NoStandardDescriptorAccessor	*bool	"PB(varint,2,opt,name=no_standard_descriptor_accessor,def=0)"
-	UninterpretedOption	[]*UninterpretedOption	"PB(bytes,999,rep,name=uninterpreted_option)"
-	XXX_extensions		map[int32][]byte
-	XXX_unrecognized	[]byte
-}
-func (this *MessageOptions) Reset() {
-	*this = MessageOptions{}
+	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
 }
 
+func (this *MessageOptions) Reset()         { *this = MessageOptions{} }
+func (this *MessageOptions) String() string { return proto.CompactTextString(this) }
+
 var extRange_MessageOptions = []proto.ExtensionRange{
 	proto.ExtensionRange{1000, 536870911},
 }
+
 func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_MessageOptions
 }
@@ -304,25 +329,27 @@ func (this *MessageOptions) ExtensionMap() map[int32][]byte {
 	}
 	return this.XXX_extensions
 }
+
 const Default_MessageOptions_MessageSetWireFormat bool = false
 const Default_MessageOptions_NoStandardDescriptorAccessor bool = false
 
 type FieldOptions struct {
-	Ctype	*FieldOptions_CType	"PB(varint,1,opt,name=ctype,enum=google_protobuf.FieldOptions_CType,def=0)"
-	Packed	*bool	"PB(varint,2,opt,name=packed)"
-	Deprecated	*bool	"PB(varint,3,opt,name=deprecated,def=0)"
-	ExperimentalMapKey	*string	"PB(bytes,9,opt,name=experimental_map_key)"
-	UninterpretedOption	[]*UninterpretedOption	"PB(bytes,999,rep,name=uninterpreted_option)"
-	XXX_extensions		map[int32][]byte
-	XXX_unrecognized	[]byte
-}
-func (this *FieldOptions) Reset() {
-	*this = FieldOptions{}
+	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"`
+	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
+	XXX_extensions      map[int32][]byte
+	XXX_unrecognized    []byte
 }
 
+func (this *FieldOptions) Reset()         { *this = FieldOptions{} }
+func (this *FieldOptions) String() string { return proto.CompactTextString(this) }
+
 var extRange_FieldOptions = []proto.ExtensionRange{
 	proto.ExtensionRange{1000, 536870911},
 }
+
 func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_FieldOptions
 }
@@ -332,21 +359,23 @@ func (this *FieldOptions) ExtensionMap() map[int32][]byte {
 	}
 	return this.XXX_extensions
 }
+
 const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING
 const Default_FieldOptions_Deprecated bool = false
 
 type EnumOptions struct {
-	UninterpretedOption	[]*UninterpretedOption	"PB(bytes,999,rep,name=uninterpreted_option)"
-	XXX_extensions		map[int32][]byte
-	XXX_unrecognized	[]byte
-}
-func (this *EnumOptions) Reset() {
-	*this = EnumOptions{}
+	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
+	XXX_extensions      map[int32][]byte
+	XXX_unrecognized    []byte
 }
 
+func (this *EnumOptions) Reset()         { *this = EnumOptions{} }
+func (this *EnumOptions) String() string { return proto.CompactTextString(this) }
+
 var extRange_EnumOptions = []proto.ExtensionRange{
 	proto.ExtensionRange{1000, 536870911},
 }
+
 func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_EnumOptions
 }
@@ -358,17 +387,18 @@ func (this *EnumOptions) ExtensionMap() map[int32][]byte {
 }
 
 type EnumValueOptions struct {
-	UninterpretedOption	[]*UninterpretedOption	"PB(bytes,999,rep,name=uninterpreted_option)"
-	XXX_extensions		map[int32][]byte
-	XXX_unrecognized	[]byte
-}
-func (this *EnumValueOptions) Reset() {
-	*this = EnumValueOptions{}
+	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
+	XXX_extensions      map[int32][]byte
+	XXX_unrecognized    []byte
 }
 
+func (this *EnumValueOptions) Reset()         { *this = EnumValueOptions{} }
+func (this *EnumValueOptions) String() string { return proto.CompactTextString(this) }
+
 var extRange_EnumValueOptions = []proto.ExtensionRange{
 	proto.ExtensionRange{1000, 536870911},
 }
+
 func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_EnumValueOptions
 }
@@ -380,17 +410,18 @@ func (this *EnumValueOptions) ExtensionMap() map[int32][]byte {
 }
 
 type ServiceOptions struct {
-	UninterpretedOption	[]*UninterpretedOption	"PB(bytes,999,rep,name=uninterpreted_option)"
-	XXX_extensions		map[int32][]byte
-	XXX_unrecognized	[]byte
-}
-func (this *ServiceOptions) Reset() {
-	*this = ServiceOptions{}
+	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
+	XXX_extensions      map[int32][]byte
+	XXX_unrecognized    []byte
 }
 
+func (this *ServiceOptions) Reset()         { *this = ServiceOptions{} }
+func (this *ServiceOptions) String() string { return proto.CompactTextString(this) }
+
 var extRange_ServiceOptions = []proto.ExtensionRange{
 	proto.ExtensionRange{1000, 536870911},
 }
+
 func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_ServiceOptions
 }
@@ -402,17 +433,18 @@ func (this *ServiceOptions) ExtensionMap() map[int32][]byte {
 }
 
 type MethodOptions struct {
-	UninterpretedOption	[]*UninterpretedOption	"PB(bytes,999,rep,name=uninterpreted_option)"
-	XXX_extensions		map[int32][]byte
-	XXX_unrecognized	[]byte
-}
-func (this *MethodOptions) Reset() {
-	*this = MethodOptions{}
+	UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option"`
+	XXX_extensions      map[int32][]byte
+	XXX_unrecognized    []byte
 }
 
+func (this *MethodOptions) Reset()         { *this = MethodOptions{} }
+func (this *MethodOptions) String() string { return proto.CompactTextString(this) }
+
 var extRange_MethodOptions = []proto.ExtensionRange{
 	proto.ExtensionRange{1000, 536870911},
 }
+
 func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange {
 	return extRange_MethodOptions
 }
@@ -424,44 +456,26 @@ func (this *MethodOptions) ExtensionMap() map[int32][]byte {
 }
 
 type UninterpretedOption struct {
-	Name	[]*UninterpretedOption_NamePart	"PB(bytes,2,rep,name=name)"
-	IdentifierValue	*string	"PB(bytes,3,opt,name=identifier_value)"
-	PositiveIntValue	*uint64	"PB(varint,4,opt,name=positive_int_value)"
-	NegativeIntValue	*int64	"PB(varint,5,opt,name=negative_int_value)"
-	DoubleValue	*float64	"PB(fixed64,6,opt,name=double_value)"
-	StringValue	[]byte	"PB(bytes,7,opt,name=string_value)"
-	AggregateValue	*string	"PB(bytes,8,opt,name=aggregate_value)"
-	XXX_unrecognized	[]byte
-}
-func (this *UninterpretedOption) Reset() {
-	*this = UninterpretedOption{}
+	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
 }
 
-type UninterpretedOption_NamePart struct {
-	NamePart	*string	"PB(bytes,1,req,name=name_part)"
-	IsExtension	*bool	"PB(varint,2,req,name=is_extension)"
-	XXX_unrecognized	[]byte
-}
-func (this *UninterpretedOption_NamePart) Reset() {
-	*this = UninterpretedOption_NamePart{}
-}
+func (this *UninterpretedOption) Reset()         { *this = UninterpretedOption{} }
+func (this *UninterpretedOption) String() string { return proto.CompactTextString(this) }
 
-type SourceCodeInfo struct {
-	Location	[]*SourceCodeInfo_Location	"PB(bytes,1,rep,name=location)"
-	XXX_unrecognized	[]byte
-}
-func (this *SourceCodeInfo) Reset() {
-	*this = SourceCodeInfo{}
+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
 }
 
-type SourceCodeInfo_Location struct {
-	Path	[]int32	"PB(varint,1,rep,packed,name=path)"
-	Span	[]int32	"PB(varint,2,rep,packed,name=span)"
-	XXX_unrecognized	[]byte
-}
-func (this *SourceCodeInfo_Location) Reset() {
-	*this = SourceCodeInfo_Location{}
-}
+func (this *UninterpretedOption_NamePart) Reset()         { *this = UninterpretedOption_NamePart{} }
+func (this *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(this) }
 
 func init() {
 	proto.RegisterEnum("google_protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value)

+ 4 - 4
compiler/generator/generator.go

@@ -359,7 +359,7 @@ func (g *Generator) Fail(msgs ...string) {
 // It then sets file name mappings defined by those entries.
 func (g *Generator) CommandLineParameters(parameter string) {
 	g.Param = make(map[string]string)
-	for _, p := range strings.Split(parameter, ",", -1) {
+	for _, p := range strings.Split(parameter, ",") {
 		if i := strings.Index(p, "="); i < 0 {
 			g.Param[p] = ""
 		} else {
@@ -847,7 +847,7 @@ func (g *Generator) generateEnum(enum *EnumDescriptor) {
 	g.P()
 }
 
-// The tag is a string like "PB(varint,2,opt,name=fieldname,def=7)" that
+// The tag is a string like "varint,2,opt,name=fieldname,def=7" that
 // identifies details of the field for the protocol buffer marshaling and unmarshaling
 // code.  The fields are:
 //	wire encoding
@@ -921,7 +921,7 @@ func (g *Generator) goTag(field *descriptor.FieldDescriptorProto, wiretype strin
 	} else {
 		name = ",name=" + name
 	}
-	return Quote(fmt.Sprintf("PB(%s,%d,%s%s%s%s%s)",
+	return Quote(fmt.Sprintf("%s,%d,%s%s%s%s%s",
 		wiretype,
 		proto.GetInt32(field.Number),
 		optrepreq,
@@ -1030,7 +1030,7 @@ func (g *Generator) generateMessage(message *Descriptor) {
 	for _, field := range message.Field {
 		fieldname := CamelCase(*field.Name)
 		typename, wiretype := g.GoType(message, field)
-		tag := g.goTag(field, wiretype)
+		tag := "`protobuf:" + g.goTag(field, wiretype) + "`"
 		g.P(fieldname, "\t", typename, "\t", tag)
 		g.RecordTypeUse(proto.GetString(field.TypeName))
 	}

+ 18 - 17
compiler/plugin/plugin.pb.go

@@ -13,34 +13,35 @@ var _ = proto.GetString
 var _ = math.Inf
 var _ os.Error
 
+
 type CodeGeneratorRequest struct {
-	FileToGenerate	[]string	"PB(bytes,1,rep,name=file_to_generate)"
-	Parameter	*string	"PB(bytes,2,opt,name=parameter)"
-	ProtoFile	[]*google_protobuf.FileDescriptorProto	"PB(bytes,15,rep,name=proto_file)"
+	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
 }
-func (this *CodeGeneratorRequest) Reset() {
-	*this = CodeGeneratorRequest{}
-}
+
+func (this *CodeGeneratorRequest) Reset()		{ *this = CodeGeneratorRequest{} }
+func (this *CodeGeneratorRequest) String() string	{ return proto.CompactTextString(this) }
 
 type CodeGeneratorResponse struct {
-	Error	*string	"PB(bytes,1,opt,name=error)"
-	File	[]*CodeGeneratorResponse_File	"PB(bytes,15,rep,name=file)"
+	Error			*string				`protobuf:"bytes,1,opt,name=error"`
+	File			[]*CodeGeneratorResponse_File	`protobuf:"bytes,15,rep,name=file"`
 	XXX_unrecognized	[]byte
 }
-func (this *CodeGeneratorResponse) Reset() {
-	*this = CodeGeneratorResponse{}
-}
+
+func (this *CodeGeneratorResponse) Reset()		{ *this = CodeGeneratorResponse{} }
+func (this *CodeGeneratorResponse) String() string	{ return proto.CompactTextString(this) }
 
 type CodeGeneratorResponse_File struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	InsertionPoint	*string	"PB(bytes,2,opt,name=insertion_point)"
-	Content	*string	"PB(bytes,15,opt,name=content)"
+	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
 }
-func (this *CodeGeneratorResponse_File) Reset() {
-	*this = CodeGeneratorResponse_File{}
-}
+
+func (this *CodeGeneratorResponse_File) Reset()		{ *this = CodeGeneratorResponse_File{} }
+func (this *CodeGeneratorResponse_File) String() string	{ return proto.CompactTextString(this) }
 
 func init() {
 }

+ 18 - 17
compiler/plugin/plugin.pb.golden

@@ -13,34 +13,35 @@ var _ = proto.GetString
 var _ = math.Inf
 var _ os.Error
 
+
 type CodeGeneratorRequest struct {
-	FileToGenerate	[]string	"PB(bytes,1,rep,name=file_to_generate)"
-	Parameter	*string	"PB(bytes,2,opt,name=parameter)"
-	ProtoFile	[]*google_protobuf.FileDescriptorProto	"PB(bytes,15,rep,name=proto_file)"
+	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
 }
-func (this *CodeGeneratorRequest) Reset() {
-	*this = CodeGeneratorRequest{}
-}
+
+func (this *CodeGeneratorRequest) Reset()		{ *this = CodeGeneratorRequest{} }
+func (this *CodeGeneratorRequest) String() string	{ return proto.CompactTextString(this) }
 
 type CodeGeneratorResponse struct {
-	Error	*string	"PB(bytes,1,opt,name=error)"
-	File	[]*CodeGeneratorResponse_File	"PB(bytes,15,rep,name=file)"
+	Error			*string				`protobuf:"bytes,1,opt,name=error"`
+	File			[]*CodeGeneratorResponse_File	`protobuf:"bytes,15,rep,name=file"`
 	XXX_unrecognized	[]byte
 }
-func (this *CodeGeneratorResponse) Reset() {
-	*this = CodeGeneratorResponse{}
-}
+
+func (this *CodeGeneratorResponse) Reset()		{ *this = CodeGeneratorResponse{} }
+func (this *CodeGeneratorResponse) String() string	{ return proto.CompactTextString(this) }
 
 type CodeGeneratorResponse_File struct {
-	Name	*string	"PB(bytes,1,opt,name=name)"
-	InsertionPoint	*string	"PB(bytes,2,opt,name=insertion_point)"
-	Content	*string	"PB(bytes,15,opt,name=content)"
+	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
 }
-func (this *CodeGeneratorResponse_File) Reset() {
-	*this = CodeGeneratorResponse_File{}
-}
+
+func (this *CodeGeneratorResponse_File) Reset()		{ *this = CodeGeneratorResponse_File{} }
+func (this *CodeGeneratorResponse_File) String() string	{ return proto.CompactTextString(this) }
 
 func init() {
 }

+ 15 - 15
compiler/testdata/test.pb.go.golden

@@ -117,13 +117,13 @@ func (x Reply_Entry_Game) String() string {
 }
 
 type Request struct {
-	Key              []int64                    "PB(varint,1,rep,name=key)"
-	ImportedMessage  *imp.ImportedMessage       "PB(bytes,2,opt,name=imported_message)"
-	Hue              *Request_Color             "PB(varint,3,opt,name=hue,enum=my_test.Request_Color)"
-	Hat              *HatType                   "PB(varint,4,opt,name=hat,enum=my_test.HatType,def=1)"
-	Owner            *imp.ImportedMessage_Owner "PB(varint,6,opt,name=owner,enum=imp.ImportedMessage_Owner)"
-	Deadline         *float32                   "PB(fixed32,7,opt,name=deadline,def=inf)"
-	Somegroup        *Request_SomeGroup         "PB(group,8,opt,name=SomeGroup)"
+	Key              []int64                    `protobuf:"varint,1,rep,name=key"`
+	ImportedMessage  *imp.ImportedMessage       `protobuf:"bytes,2,opt,name=imported_message"`
+	Hue              *Request_Color             `protobuf:"varint,3,opt,name=hue,enum=my_test.Request_Color"`
+	Hat              *HatType                   `protobuf:"varint,4,opt,name=hat,enum=my_test.HatType,def=1"`
+	Owner            *imp.ImportedMessage_Owner `protobuf:"varint,6,opt,name=owner,enum=imp.ImportedMessage_Owner"`
+	Deadline         *float32                   `protobuf:"fixed32,7,opt,name=deadline,def=inf"`
+	Somegroup        *Request_SomeGroup         `protobuf:"group,8,opt,name=SomeGroup"`
 	XXX_unrecognized []byte
 }
 
@@ -135,7 +135,7 @@ const Default_Request_Hat HatType = HatType_FEDORA
 var Default_Request_Deadline float32 = float32(math.Inf(1))
 
 type Request_SomeGroup struct {
-	GroupField       *int32 "PB(varint,9,opt,name=group_field)"
+	GroupField       *int32 `protobuf:"varint,9,opt,name=group_field"`
 	XXX_unrecognized []byte
 }
 
@@ -143,8 +143,8 @@ func (this *Request_SomeGroup) Reset()         { *this = Request_SomeGroup{} }
 func (this *Request_SomeGroup) String() string { return proto.CompactTextString(this) }
 
 type Reply struct {
-	Found            []*Reply_Entry "PB(bytes,1,rep,name=found)"
-	CompactKeys      []int32        "PB(varint,2,rep,packed,name=compact_keys)"
+	Found            []*Reply_Entry `protobuf:"bytes,1,rep,name=found"`
+	CompactKeys      []int32        `protobuf:"varint,2,rep,packed,name=compact_keys"`
 	XXX_extensions   map[int32][]byte
 	XXX_unrecognized []byte
 }
@@ -167,9 +167,9 @@ func (this *Reply) ExtensionMap() map[int32][]byte {
 }
 
 type Reply_Entry struct {
-	KeyThatNeeds_1234Camel_CasIng *int64 "PB(varint,1,req,name=key_that_needs_1234camel_CasIng)"
-	Value                         *int64 "PB(varint,2,opt,name=value,def=7)"
-	XMyFieldName_2                *int64 "PB(varint,3,opt,name=_my_field_name_2)"
+	KeyThatNeeds_1234Camel_CasIng *int64 `protobuf:"varint,1,req,name=key_that_needs_1234camel_CasIng"`
+	Value                         *int64 `protobuf:"varint,2,opt,name=value,def=7"`
+	XMyFieldName_2                *int64 `protobuf:"varint,3,opt,name=_my_field_name_2"`
 	XXX_unrecognized              []byte
 }
 
@@ -190,7 +190,7 @@ var E_ReplyExtensions_Time = &proto.ExtensionDesc{
 	ExtensionType: (*float64)(nil),
 	Field:         101,
 	Name:          "my_test.time",
-	Tag:           "PB(fixed64,101,opt,name=time)",
+	Tag:           "fixed64,101,opt,name=time",
 }
 
 type OldReply struct {
@@ -230,7 +230,7 @@ var E_Tag = &proto.ExtensionDesc{
 	ExtensionType: (*string)(nil),
 	Field:         103,
 	Name:          "my_test.tag",
-	Tag:           "PB(bytes,103,opt,name=tag)",
+	Tag:           "bytes,103,opt,name=tag",
 }
 
 func init() {

+ 1 - 1
proto/extensions.go

@@ -62,7 +62,7 @@ type ExtensionDesc struct {
 	ExtensionType interface{} // nil pointer to the extension type
 	Field         int32       // field number
 	Name          string      // fully-qualified name of extension
-	Tag           string      // PB(...) tag style
+	Tag           string      // protobuf tag style
 }
 
 // isExtensionField returns true iff the given field number is in an extension range.

+ 5 - 5
proto/lib.go

@@ -101,10 +101,10 @@
 		}
 
 		type Test struct {
-			Label	*string	"PB(bytes,1,req,name=label)"
-			Type	*int32	"PB(varint,2,opt,name=type,def=77)"
-			Reps	[]int64	"PB(varint,3,rep,name=reps)"
-			Optionalgroup	*Test_OptionalGroup	"PB(group,4,opt,name=optionalgroup)"
+			Label	*string	`protobuf:"bytes,1,req,name=label"`
+			Type	*int32	`protobuf:"varint,2,opt,name=type,def=77"`
+			Reps	[]int64	`protobuf:"varint,3,rep,name=reps"`
+			Optionalgroup	*Test_OptionalGroup	`protobuf:"group,4,opt,name=optionalgroup"`
 			XXX_unrecognized []byte
 		}
 		func (this *Test) Reset() {
@@ -113,7 +113,7 @@
 		const Default_Test_Type int32 = 77
 
 		type Test_OptionalGroup struct {
-			RequiredField	*string	"PB(bytes,5,req)"
+			RequiredField	*string	`protobuf:"bytes,5,req"`
 			XXX_unrecognized []byte
 		}
 		func (this *Test_OptionalGroup) Reset() {

+ 4 - 4
proto/message_set.go

@@ -58,17 +58,17 @@ var ErrNoMessageTypeId = os.NewError("proto does not have a message type ID")
 // When a proto1 proto has a field that looks like:
 //   optional message<MessageSet> info = 3;
 // the protocol compiler produces a field in the generated struct that looks like:
-//   Info *_proto_.MessageSet  "PB(bytes,3,opt,name=info)"
+//   Info *_proto_.MessageSet  `protobuf:"bytes,3,opt,name=info"`
 // The package is automatically inserted so there is no need for that proto file to
 // import this package.
 
 type _MessageSet_Item struct {
-	TypeId  *int32 "PB(varint,2,req,name=type_id)"
-	Message []byte "PB(bytes,3,req,name=message)"
+	TypeId  *int32 `protobuf:"varint,2,req,name=type_id"`
+	Message []byte `protobuf:"bytes,3,req,name=message"`
 }
 
 type MessageSet struct {
-	Item             []*_MessageSet_Item "PB(group,1,rep)"
+	Item             []*_MessageSet_Item `protobuf:"group,1,rep"`
 	XXX_unrecognized *bytes.Buffer
 	// TODO: caching?
 }

+ 8 - 9
proto/properties.go

@@ -116,7 +116,7 @@ type Properties struct {
 	packedDec decoder
 }
 
-// String formats the properties in the "PB(...)" struct tag style.
+// String formats the properties in the protobuf struct field tag style.
 func (p *Properties) String() string {
 	s := p.Wire
 	s = ","
@@ -145,10 +145,10 @@ func (p *Properties) String() string {
 	return s
 }
 
-// Parse populates p by parsing a string in the "PB(...)" struct tag style.
+// Parse populates p by parsing a string in the protobuf struct field tag style.
 func (p *Properties) Parse(s string) {
 	// "bytes,49,opt,def=hello!,name=foo"
-	fields := strings.Split(s, ",", -1) // breaks def=, but handled below.
+	fields := strings.Split(s, ",") // breaks def=, but handled below.
 	if len(fields) < 2 {
 		fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s)
 		return
@@ -411,18 +411,17 @@ func (p *Properties) setEncAndDec(typ reflect.Type) {
 	p.tagcode = p.tagbuf[0 : i+1]
 }
 
-// Init populates the properties from a protocol buffer struct field.
+// Init populates the properties from a protocol buffer struct tag.
 func (p *Properties) Init(typ reflect.Type, name, tag string, offset uintptr) {
-	// "PB(bytes,49,opt,def=hello!)"
-	// TODO: should not assume the only thing is PB(...)
+	// "bytes,49,opt,def=hello!"
 	p.Name = name
 	p.OrigName = name
 	p.offset = offset
 
-	if len(tag) < 4 || tag[0:3] != "PB(" || tag[len(tag)-1] != ')' {
+	if tag == "" {
 		return
 	}
-	p.Parse(tag[3 : len(tag)-1])
+	p.Parse(tag)
 	p.setEncAndDec(typ)
 }
 
@@ -449,7 +448,7 @@ func GetProperties(t reflect.Type) *StructProperties {
 	for i := 0; i < t.NumField(); i++ {
 		f := t.Field(i)
 		p := new(Properties)
-		p.Init(f.Type, f.Name, f.Tag, f.Offset)
+		p.Init(f.Type, f.Name, f.Tag.Get("protobuf"), f.Offset)
 		if f.Name == "XXX_extensions" { // special case
 			var vmap map[int32][]byte
 			p.enc = (*Buffer).enc_map

+ 108 - 108
proto/testdata/test.pb.go

@@ -119,7 +119,7 @@ func (x MyMessage_Color) String() string {
 }
 
 type GoEnum struct {
-	Foo			*FOO	"PB(varint,1,req,name=foo,enum=test_proto.FOO)"
+	Foo			*FOO	`protobuf:"varint,1,req,name=foo,enum=test_proto.FOO"`
 	XXX_unrecognized	[]byte
 }
 
@@ -127,8 +127,8 @@ func (this *GoEnum) Reset()		{ *this = GoEnum{} }
 func (this *GoEnum) String() string	{ return proto.CompactTextString(this) }
 
 type GoTestField struct {
-	Label			*string	"PB(bytes,1,req)"
-	Type			*string	"PB(bytes,2,req)"
+	Label			*string	`protobuf:"bytes,1,req"`
+	Type			*string	`protobuf:"bytes,2,req"`
 	XXX_unrecognized	[]byte
 }
 
@@ -136,78 +136,78 @@ func (this *GoTestField) Reset()		{ *this = GoTestField{} }
 func (this *GoTestField) String() string	{ return proto.CompactTextString(this) }
 
 type GoTest struct {
-	Kind			*int32			"PB(varint,1,req)"
-	Table			*string			"PB(bytes,2,opt)"
-	Param			*int32			"PB(varint,3,opt)"
-	RequiredField		*GoTestField		"PB(bytes,4,req)"
-	RepeatedField		[]*GoTestField		"PB(bytes,5,rep)"
-	OptionalField		*GoTestField		"PB(bytes,6,opt)"
-	F_BoolRequired		*bool			"PB(varint,10,req,name=F_Bool_required)"
-	F_Int32Required		*int32			"PB(varint,11,req,name=F_Int32_required)"
-	F_Int64Required		*int64			"PB(varint,12,req,name=F_Int64_required)"
-	F_Fixed32Required	*uint32			"PB(fixed32,13,req,name=F_Fixed32_required)"
-	F_Fixed64Required	*uint64			"PB(fixed64,14,req,name=F_Fixed64_required)"
-	F_Uint32Required	*uint32			"PB(varint,15,req,name=F_Uint32_required)"
-	F_Uint64Required	*uint64			"PB(varint,16,req,name=F_Uint64_required)"
-	F_FloatRequired		*float32		"PB(fixed32,17,req,name=F_Float_required)"
-	F_DoubleRequired	*float64		"PB(fixed64,18,req,name=F_Double_required)"
-	F_StringRequired	*string			"PB(bytes,19,req,name=F_String_required)"
-	F_BytesRequired		[]byte			"PB(bytes,101,req,name=F_Bytes_required)"
-	F_Sint32Required	*int32			"PB(zigzag32,102,req,name=F_Sint32_required)"
-	F_Sint64Required	*int64			"PB(zigzag64,103,req,name=F_Sint64_required)"
-	F_BoolRepeated		[]bool			"PB(varint,20,rep,name=F_Bool_repeated)"
-	F_Int32Repeated		[]int32			"PB(varint,21,rep,name=F_Int32_repeated)"
-	F_Int64Repeated		[]int64			"PB(varint,22,rep,name=F_Int64_repeated)"
-	F_Fixed32Repeated	[]uint32		"PB(fixed32,23,rep,name=F_Fixed32_repeated)"
-	F_Fixed64Repeated	[]uint64		"PB(fixed64,24,rep,name=F_Fixed64_repeated)"
-	F_Uint32Repeated	[]uint32		"PB(varint,25,rep,name=F_Uint32_repeated)"
-	F_Uint64Repeated	[]uint64		"PB(varint,26,rep,name=F_Uint64_repeated)"
-	F_FloatRepeated		[]float32		"PB(fixed32,27,rep,name=F_Float_repeated)"
-	F_DoubleRepeated	[]float64		"PB(fixed64,28,rep,name=F_Double_repeated)"
-	F_StringRepeated	[]string		"PB(bytes,29,rep,name=F_String_repeated)"
-	F_BytesRepeated		[][]byte		"PB(bytes,201,rep,name=F_Bytes_repeated)"
-	F_Sint32Repeated	[]int32			"PB(zigzag32,202,rep,name=F_Sint32_repeated)"
-	F_Sint64Repeated	[]int64			"PB(zigzag64,203,rep,name=F_Sint64_repeated)"
-	F_BoolOptional		*bool			"PB(varint,30,opt,name=F_Bool_optional)"
-	F_Int32Optional		*int32			"PB(varint,31,opt,name=F_Int32_optional)"
-	F_Int64Optional		*int64			"PB(varint,32,opt,name=F_Int64_optional)"
-	F_Fixed32Optional	*uint32			"PB(fixed32,33,opt,name=F_Fixed32_optional)"
-	F_Fixed64Optional	*uint64			"PB(fixed64,34,opt,name=F_Fixed64_optional)"
-	F_Uint32Optional	*uint32			"PB(varint,35,opt,name=F_Uint32_optional)"
-	F_Uint64Optional	*uint64			"PB(varint,36,opt,name=F_Uint64_optional)"
-	F_FloatOptional		*float32		"PB(fixed32,37,opt,name=F_Float_optional)"
-	F_DoubleOptional	*float64		"PB(fixed64,38,opt,name=F_Double_optional)"
-	F_StringOptional	*string			"PB(bytes,39,opt,name=F_String_optional)"
-	F_BytesOptional		[]byte			"PB(bytes,301,opt,name=F_Bytes_optional)"
-	F_Sint32Optional	*int32			"PB(zigzag32,302,opt,name=F_Sint32_optional)"
-	F_Sint64Optional	*int64			"PB(zigzag64,303,opt,name=F_Sint64_optional)"
-	F_BoolDefaulted		*bool			"PB(varint,40,opt,name=F_Bool_defaulted,def=1)"
-	F_Int32Defaulted	*int32			"PB(varint,41,opt,name=F_Int32_defaulted,def=32)"
-	F_Int64Defaulted	*int64			"PB(varint,42,opt,name=F_Int64_defaulted,def=64)"
-	F_Fixed32Defaulted	*uint32			"PB(fixed32,43,opt,name=F_Fixed32_defaulted,def=320)"
-	F_Fixed64Defaulted	*uint64			"PB(fixed64,44,opt,name=F_Fixed64_defaulted,def=640)"
-	F_Uint32Defaulted	*uint32			"PB(varint,45,opt,name=F_Uint32_defaulted,def=3200)"
-	F_Uint64Defaulted	*uint64			"PB(varint,46,opt,name=F_Uint64_defaulted,def=6400)"
-	F_FloatDefaulted	*float32		"PB(fixed32,47,opt,name=F_Float_defaulted,def=314159)"
-	F_DoubleDefaulted	*float64		"PB(fixed64,48,opt,name=F_Double_defaulted,def=271828)"
-	F_StringDefaulted	*string			"PB(bytes,49,opt,name=F_String_defaulted,def=hello, \\\"world!\\\"\\n)"
-	F_BytesDefaulted	[]byte			"PB(bytes,401,opt,name=F_Bytes_defaulted,def=Bignose)"
-	F_Sint32Defaulted	*int32			"PB(zigzag32,402,opt,name=F_Sint32_defaulted,def=-32)"
-	F_Sint64Defaulted	*int64			"PB(zigzag64,403,opt,name=F_Sint64_defaulted,def=-64)"
-	F_BoolRepeatedPacked	[]bool			"PB(varint,50,rep,packed,name=F_Bool_repeated_packed)"
-	F_Int32RepeatedPacked	[]int32			"PB(varint,51,rep,packed,name=F_Int32_repeated_packed)"
-	F_Int64RepeatedPacked	[]int64			"PB(varint,52,rep,packed,name=F_Int64_repeated_packed)"
-	F_Fixed32RepeatedPacked	[]uint32		"PB(fixed32,53,rep,packed,name=F_Fixed32_repeated_packed)"
-	F_Fixed64RepeatedPacked	[]uint64		"PB(fixed64,54,rep,packed,name=F_Fixed64_repeated_packed)"
-	F_Uint32RepeatedPacked	[]uint32		"PB(varint,55,rep,packed,name=F_Uint32_repeated_packed)"
-	F_Uint64RepeatedPacked	[]uint64		"PB(varint,56,rep,packed,name=F_Uint64_repeated_packed)"
-	F_FloatRepeatedPacked	[]float32		"PB(fixed32,57,rep,packed,name=F_Float_repeated_packed)"
-	F_DoubleRepeatedPacked	[]float64		"PB(fixed64,58,rep,packed,name=F_Double_repeated_packed)"
-	F_Sint32RepeatedPacked	[]int32			"PB(zigzag32,502,rep,packed,name=F_Sint32_repeated_packed)"
-	F_Sint64RepeatedPacked	[]int64			"PB(zigzag64,503,rep,packed,name=F_Sint64_repeated_packed)"
-	Requiredgroup		*GoTest_RequiredGroup	"PB(group,70,req,name=RequiredGroup)"
-	Repeatedgroup		[]*GoTest_RepeatedGroup	"PB(group,80,rep,name=RepeatedGroup)"
-	Optionalgroup		*GoTest_OptionalGroup	"PB(group,90,opt,name=OptionalGroup)"
+	Kind			*int32			`protobuf:"varint,1,req"`
+	Table			*string			`protobuf:"bytes,2,opt"`
+	Param			*int32			`protobuf:"varint,3,opt"`
+	RequiredField		*GoTestField		`protobuf:"bytes,4,req"`
+	RepeatedField		[]*GoTestField		`protobuf:"bytes,5,rep"`
+	OptionalField		*GoTestField		`protobuf:"bytes,6,opt"`
+	F_BoolRequired		*bool			`protobuf:"varint,10,req,name=F_Bool_required"`
+	F_Int32Required		*int32			`protobuf:"varint,11,req,name=F_Int32_required"`
+	F_Int64Required		*int64			`protobuf:"varint,12,req,name=F_Int64_required"`
+	F_Fixed32Required	*uint32			`protobuf:"fixed32,13,req,name=F_Fixed32_required"`
+	F_Fixed64Required	*uint64			`protobuf:"fixed64,14,req,name=F_Fixed64_required"`
+	F_Uint32Required	*uint32			`protobuf:"varint,15,req,name=F_Uint32_required"`
+	F_Uint64Required	*uint64			`protobuf:"varint,16,req,name=F_Uint64_required"`
+	F_FloatRequired		*float32		`protobuf:"fixed32,17,req,name=F_Float_required"`
+	F_DoubleRequired	*float64		`protobuf:"fixed64,18,req,name=F_Double_required"`
+	F_StringRequired	*string			`protobuf:"bytes,19,req,name=F_String_required"`
+	F_BytesRequired		[]byte			`protobuf:"bytes,101,req,name=F_Bytes_required"`
+	F_Sint32Required	*int32			`protobuf:"zigzag32,102,req,name=F_Sint32_required"`
+	F_Sint64Required	*int64			`protobuf:"zigzag64,103,req,name=F_Sint64_required"`
+	F_BoolRepeated		[]bool			`protobuf:"varint,20,rep,name=F_Bool_repeated"`
+	F_Int32Repeated		[]int32			`protobuf:"varint,21,rep,name=F_Int32_repeated"`
+	F_Int64Repeated		[]int64			`protobuf:"varint,22,rep,name=F_Int64_repeated"`
+	F_Fixed32Repeated	[]uint32		`protobuf:"fixed32,23,rep,name=F_Fixed32_repeated"`
+	F_Fixed64Repeated	[]uint64		`protobuf:"fixed64,24,rep,name=F_Fixed64_repeated"`
+	F_Uint32Repeated	[]uint32		`protobuf:"varint,25,rep,name=F_Uint32_repeated"`
+	F_Uint64Repeated	[]uint64		`protobuf:"varint,26,rep,name=F_Uint64_repeated"`
+	F_FloatRepeated		[]float32		`protobuf:"fixed32,27,rep,name=F_Float_repeated"`
+	F_DoubleRepeated	[]float64		`protobuf:"fixed64,28,rep,name=F_Double_repeated"`
+	F_StringRepeated	[]string		`protobuf:"bytes,29,rep,name=F_String_repeated"`
+	F_BytesRepeated		[][]byte		`protobuf:"bytes,201,rep,name=F_Bytes_repeated"`
+	F_Sint32Repeated	[]int32			`protobuf:"zigzag32,202,rep,name=F_Sint32_repeated"`
+	F_Sint64Repeated	[]int64			`protobuf:"zigzag64,203,rep,name=F_Sint64_repeated"`
+	F_BoolOptional		*bool			`protobuf:"varint,30,opt,name=F_Bool_optional"`
+	F_Int32Optional		*int32			`protobuf:"varint,31,opt,name=F_Int32_optional"`
+	F_Int64Optional		*int64			`protobuf:"varint,32,opt,name=F_Int64_optional"`
+	F_Fixed32Optional	*uint32			`protobuf:"fixed32,33,opt,name=F_Fixed32_optional"`
+	F_Fixed64Optional	*uint64			`protobuf:"fixed64,34,opt,name=F_Fixed64_optional"`
+	F_Uint32Optional	*uint32			`protobuf:"varint,35,opt,name=F_Uint32_optional"`
+	F_Uint64Optional	*uint64			`protobuf:"varint,36,opt,name=F_Uint64_optional"`
+	F_FloatOptional		*float32		`protobuf:"fixed32,37,opt,name=F_Float_optional"`
+	F_DoubleOptional	*float64		`protobuf:"fixed64,38,opt,name=F_Double_optional"`
+	F_StringOptional	*string			`protobuf:"bytes,39,opt,name=F_String_optional"`
+	F_BytesOptional		[]byte			`protobuf:"bytes,301,opt,name=F_Bytes_optional"`
+	F_Sint32Optional	*int32			`protobuf:"zigzag32,302,opt,name=F_Sint32_optional"`
+	F_Sint64Optional	*int64			`protobuf:"zigzag64,303,opt,name=F_Sint64_optional"`
+	F_BoolDefaulted		*bool			`protobuf:"varint,40,opt,name=F_Bool_defaulted,def=1"`
+	F_Int32Defaulted	*int32			`protobuf:"varint,41,opt,name=F_Int32_defaulted,def=32"`
+	F_Int64Defaulted	*int64			`protobuf:"varint,42,opt,name=F_Int64_defaulted,def=64"`
+	F_Fixed32Defaulted	*uint32			`protobuf:"fixed32,43,opt,name=F_Fixed32_defaulted,def=320"`
+	F_Fixed64Defaulted	*uint64			`protobuf:"fixed64,44,opt,name=F_Fixed64_defaulted,def=640"`
+	F_Uint32Defaulted	*uint32			`protobuf:"varint,45,opt,name=F_Uint32_defaulted,def=3200"`
+	F_Uint64Defaulted	*uint64			`protobuf:"varint,46,opt,name=F_Uint64_defaulted,def=6400"`
+	F_FloatDefaulted	*float32		`protobuf:"fixed32,47,opt,name=F_Float_defaulted,def=314159"`
+	F_DoubleDefaulted	*float64		`protobuf:"fixed64,48,opt,name=F_Double_defaulted,def=271828"`
+	F_StringDefaulted	*string			`protobuf:"bytes,49,opt,name=F_String_defaulted,def=hello, \\\"world!\\\"\\n"`
+	F_BytesDefaulted	[]byte			`protobuf:"bytes,401,opt,name=F_Bytes_defaulted,def=Bignose"`
+	F_Sint32Defaulted	*int32			`protobuf:"zigzag32,402,opt,name=F_Sint32_defaulted,def=-32"`
+	F_Sint64Defaulted	*int64			`protobuf:"zigzag64,403,opt,name=F_Sint64_defaulted,def=-64"`
+	F_BoolRepeatedPacked	[]bool			`protobuf:"varint,50,rep,packed,name=F_Bool_repeated_packed"`
+	F_Int32RepeatedPacked	[]int32			`protobuf:"varint,51,rep,packed,name=F_Int32_repeated_packed"`
+	F_Int64RepeatedPacked	[]int64			`protobuf:"varint,52,rep,packed,name=F_Int64_repeated_packed"`
+	F_Fixed32RepeatedPacked	[]uint32		`protobuf:"fixed32,53,rep,packed,name=F_Fixed32_repeated_packed"`
+	F_Fixed64RepeatedPacked	[]uint64		`protobuf:"fixed64,54,rep,packed,name=F_Fixed64_repeated_packed"`
+	F_Uint32RepeatedPacked	[]uint32		`protobuf:"varint,55,rep,packed,name=F_Uint32_repeated_packed"`
+	F_Uint64RepeatedPacked	[]uint64		`protobuf:"varint,56,rep,packed,name=F_Uint64_repeated_packed"`
+	F_FloatRepeatedPacked	[]float32		`protobuf:"fixed32,57,rep,packed,name=F_Float_repeated_packed"`
+	F_DoubleRepeatedPacked	[]float64		`protobuf:"fixed64,58,rep,packed,name=F_Double_repeated_packed"`
+	F_Sint32RepeatedPacked	[]int32			`protobuf:"zigzag32,502,rep,packed,name=F_Sint32_repeated_packed"`
+	F_Sint64RepeatedPacked	[]int64			`protobuf:"zigzag64,503,rep,packed,name=F_Sint64_repeated_packed"`
+	Requiredgroup		*GoTest_RequiredGroup	`protobuf:"group,70,req,name=RequiredGroup"`
+	Repeatedgroup		[]*GoTest_RepeatedGroup	`protobuf:"group,80,rep,name=RepeatedGroup"`
+	Optionalgroup		*GoTest_OptionalGroup	`protobuf:"group,90,opt,name=OptionalGroup"`
 	XXX_unrecognized	[]byte
 }
 
@@ -231,7 +231,7 @@ const Default_GoTest_F_Sint32Defaulted int32 = -32
 const Default_GoTest_F_Sint64Defaulted int64 = -64
 
 type GoTest_RequiredGroup struct {
-	RequiredField		*string	"PB(bytes,71,req)"
+	RequiredField		*string	`protobuf:"bytes,71,req"`
 	XXX_unrecognized	[]byte
 }
 
@@ -239,7 +239,7 @@ func (this *GoTest_RequiredGroup) Reset()		{ *this = GoTest_RequiredGroup{} }
 func (this *GoTest_RequiredGroup) String() string	{ return proto.CompactTextString(this) }
 
 type GoTest_RepeatedGroup struct {
-	RequiredField		*string	"PB(bytes,81,req)"
+	RequiredField		*string	`protobuf:"bytes,81,req"`
 	XXX_unrecognized	[]byte
 }
 
@@ -247,7 +247,7 @@ func (this *GoTest_RepeatedGroup) Reset()		{ *this = GoTest_RepeatedGroup{} }
 func (this *GoTest_RepeatedGroup) String() string	{ return proto.CompactTextString(this) }
 
 type GoTest_OptionalGroup struct {
-	RequiredField		*string	"PB(bytes,91,req)"
+	RequiredField		*string	`protobuf:"bytes,91,req"`
 	XXX_unrecognized	[]byte
 }
 
@@ -255,11 +255,11 @@ func (this *GoTest_OptionalGroup) Reset()		{ *this = GoTest_OptionalGroup{} }
 func (this *GoTest_OptionalGroup) String() string	{ return proto.CompactTextString(this) }
 
 type GoSkipTest struct {
-	SkipInt32		*int32			"PB(varint,11,req,name=skip_int32)"
-	SkipFixed32		*uint32			"PB(fixed32,12,req,name=skip_fixed32)"
-	SkipFixed64		*uint64			"PB(fixed64,13,req,name=skip_fixed64)"
-	SkipString		*string			"PB(bytes,14,req,name=skip_string)"
-	Skipgroup		*GoSkipTest_SkipGroup	"PB(group,15,req,name=SkipGroup)"
+	SkipInt32		*int32			`protobuf:"varint,11,req,name=skip_int32"`
+	SkipFixed32		*uint32			`protobuf:"fixed32,12,req,name=skip_fixed32"`
+	SkipFixed64		*uint64			`protobuf:"fixed64,13,req,name=skip_fixed64"`
+	SkipString		*string			`protobuf:"bytes,14,req,name=skip_string"`
+	Skipgroup		*GoSkipTest_SkipGroup	`protobuf:"group,15,req,name=SkipGroup"`
 	XXX_unrecognized	[]byte
 }
 
@@ -267,8 +267,8 @@ func (this *GoSkipTest) Reset()		{ *this = GoSkipTest{} }
 func (this *GoSkipTest) String() string	{ return proto.CompactTextString(this) }
 
 type GoSkipTest_SkipGroup struct {
-	GroupInt32		*int32	"PB(varint,16,req,name=group_int32)"
-	GroupString		*string	"PB(bytes,17,req,name=group_string)"
+	GroupInt32		*int32	`protobuf:"varint,16,req,name=group_int32"`
+	GroupString		*string	`protobuf:"bytes,17,req,name=group_string"`
 	XXX_unrecognized	[]byte
 }
 
@@ -276,7 +276,7 @@ func (this *GoSkipTest_SkipGroup) Reset()		{ *this = GoSkipTest_SkipGroup{} }
 func (this *GoSkipTest_SkipGroup) String() string	{ return proto.CompactTextString(this) }
 
 type NonPackedTest struct {
-	A			[]int32	"PB(varint,1,rep,name=a)"
+	A			[]int32	`protobuf:"varint,1,rep,name=a"`
 	XXX_unrecognized	[]byte
 }
 
@@ -284,7 +284,7 @@ func (this *NonPackedTest) Reset()		{ *this = NonPackedTest{} }
 func (this *NonPackedTest) String() string	{ return proto.CompactTextString(this) }
 
 type PackedTest struct {
-	B			[]int32	"PB(varint,1,rep,packed,name=b)"
+	B			[]int32	`protobuf:"varint,1,rep,packed,name=b"`
 	XXX_unrecognized	[]byte
 }
 
@@ -292,9 +292,9 @@ func (this *PackedTest) Reset()		{ *this = PackedTest{} }
 func (this *PackedTest) String() string	{ return proto.CompactTextString(this) }
 
 type InnerMessage struct {
-	Host			*string	"PB(bytes,1,req,name=host)"
-	Port			*int32	"PB(varint,2,opt,name=port,def=4000)"
-	Connected		*bool	"PB(varint,3,opt,name=connected)"
+	Host			*string	`protobuf:"bytes,1,req,name=host"`
+	Port			*int32	`protobuf:"varint,2,opt,name=port,def=4000"`
+	Connected		*bool	`protobuf:"varint,3,opt,name=connected"`
 	XXX_unrecognized	[]byte
 }
 
@@ -304,10 +304,10 @@ func (this *InnerMessage) String() string	{ return proto.CompactTextString(this)
 const Default_InnerMessage_Port int32 = 4000
 
 type OtherMessage struct {
-	Key			*int64		"PB(varint,1,opt,name=key)"
-	Value			[]byte		"PB(bytes,2,opt,name=value)"
-	Weight			*float32	"PB(fixed32,3,opt,name=weight)"
-	Inner			*InnerMessage	"PB(bytes,4,opt,name=inner)"
+	Key			*int64		`protobuf:"varint,1,opt,name=key"`
+	Value			[]byte		`protobuf:"bytes,2,opt,name=value"`
+	Weight			*float32	`protobuf:"fixed32,3,opt,name=weight"`
+	Inner			*InnerMessage	`protobuf:"bytes,4,opt,name=inner"`
 	XXX_unrecognized	[]byte
 }
 
@@ -315,14 +315,14 @@ func (this *OtherMessage) Reset()		{ *this = OtherMessage{} }
 func (this *OtherMessage) String() string	{ return proto.CompactTextString(this) }
 
 type MyMessage struct {
-	Count			*int32			"PB(varint,1,req,name=count)"
-	Name			*string			"PB(bytes,2,opt,name=name)"
-	Quote			*string			"PB(bytes,3,opt,name=quote)"
-	Pet			[]string		"PB(bytes,4,rep,name=pet)"
-	Inner			*InnerMessage		"PB(bytes,5,opt,name=inner)"
-	Others			[]*OtherMessage		"PB(bytes,6,rep,name=others)"
-	Bikeshed		*MyMessage_Color	"PB(varint,7,opt,name=bikeshed,enum=test_proto.MyMessage_Color)"
-	Somegroup		*MyMessage_SomeGroup	"PB(group,8,opt,name=SomeGroup)"
+	Count			*int32			`protobuf:"varint,1,req,name=count"`
+	Name			*string			`protobuf:"bytes,2,opt,name=name"`
+	Quote			*string			`protobuf:"bytes,3,opt,name=quote"`
+	Pet			[]string		`protobuf:"bytes,4,rep,name=pet"`
+	Inner			*InnerMessage		`protobuf:"bytes,5,opt,name=inner"`
+	Others			[]*OtherMessage		`protobuf:"bytes,6,rep,name=others"`
+	Bikeshed		*MyMessage_Color	`protobuf:"varint,7,opt,name=bikeshed,enum=test_proto.MyMessage_Color"`
+	Somegroup		*MyMessage_SomeGroup	`protobuf:"group,8,opt,name=SomeGroup"`
 	XXX_extensions		map[int32][]byte
 	XXX_unrecognized	[]byte
 }
@@ -345,7 +345,7 @@ func (this *MyMessage) ExtensionMap() map[int32][]byte {
 }
 
 type MyMessage_SomeGroup struct {
-	GroupField		*int32	"PB(varint,9,opt,name=group_field)"
+	GroupField		*int32	`protobuf:"varint,9,opt,name=group_field"`
 	XXX_unrecognized	[]byte
 }
 
@@ -353,7 +353,7 @@ func (this *MyMessage_SomeGroup) Reset()		{ *this = MyMessage_SomeGroup{} }
 func (this *MyMessage_SomeGroup) String() string	{ return proto.CompactTextString(this) }
 
 type Ext struct {
-	Data			*string	"PB(bytes,1,opt,name=data)"
+	Data			*string	`protobuf:"bytes,1,opt,name=data"`
 	XXX_unrecognized	[]byte
 }
 
@@ -365,11 +365,11 @@ var E_Ext_More = &proto.ExtensionDesc{
 	ExtensionType:	(*Ext)(nil),
 	Field:		103,
 	Name:		"test_proto.more",
-	Tag:		"PB(bytes,103,opt,name=more)",
+	Tag:		"bytes,103,opt,name=more",
 }
 
 type MessageList struct {
-	Message			[]*MessageList_Message	"PB(group,1,rep)"
+	Message			[]*MessageList_Message	`protobuf:"group,1,rep"`
 	XXX_unrecognized	[]byte
 }
 
@@ -377,8 +377,8 @@ func (this *MessageList) Reset()		{ *this = MessageList{} }
 func (this *MessageList) String() string	{ return proto.CompactTextString(this) }
 
 type MessageList_Message struct {
-	Name			*string	"PB(bytes,2,req,name=name)"
-	Count			*int32	"PB(varint,3,req,name=count)"
+	Name			*string	`protobuf:"bytes,2,req,name=name"`
+	Count			*int32	`protobuf:"varint,3,req,name=count"`
 	XXX_unrecognized	[]byte
 }
 

+ 276 - 220
proto/testdata/test.pb.go.golden

@@ -4,190 +4,216 @@
 package test_proto
 
 import proto "goprotobuf.googlecode.com/hg/proto"
+import "math"
+import "os"
 
-// Reference proto import to suppress error if it's not otherwise used.
+// Reference proto, math & os imports to suppress error if they are not otherwise used.
 var _ = proto.GetString
+var _ = math.Inf
+var _ os.Error
+
 
 type FOO int32
+
 const (
 	FOO_FOO1 = 1
 )
-var FOO_name = map[int32] string {
+
+var FOO_name = map[int32]string{
 	1: "FOO1",
 }
-var FOO_value = map[string] int32 {
+var FOO_value = map[string]int32{
 	"FOO1": 1,
 }
+
 func NewFOO(x int32) *FOO {
 	e := FOO(x)
 	return &e
 }
+func (x FOO) String() string {
+	return proto.EnumName(FOO_name, int32(x))
+}
 
 type GoTest_KIND int32
+
 const (
-	GoTest_VOID = 0
-	GoTest_BOOL = 1
-	GoTest_BYTES = 2
-	GoTest_FINGERPRINT = 3
-	GoTest_FLOAT = 4
-	GoTest_INT = 5
-	GoTest_STRING = 6
-	GoTest_TIME = 7
-	GoTest_TUPLE = 8
-	GoTest_ARRAY = 9
-	GoTest_MAP = 10
-	GoTest_TABLE = 11
-	GoTest_FUNCTION = 12
+	GoTest_VOID		= 0
+	GoTest_BOOL		= 1
+	GoTest_BYTES		= 2
+	GoTest_FINGERPRINT	= 3
+	GoTest_FLOAT		= 4
+	GoTest_INT		= 5
+	GoTest_STRING		= 6
+	GoTest_TIME		= 7
+	GoTest_TUPLE		= 8
+	GoTest_ARRAY		= 9
+	GoTest_MAP		= 10
+	GoTest_TABLE		= 11
+	GoTest_FUNCTION		= 12
 )
-var GoTest_KIND_name = map[int32] string {
-	0: "VOID",
-	1: "BOOL",
-	2: "BYTES",
-	3: "FINGERPRINT",
-	4: "FLOAT",
-	5: "INT",
-	6: "STRING",
-	7: "TIME",
-	8: "TUPLE",
-	9: "ARRAY",
-	10: "MAP",
-	11: "TABLE",
-	12: "FUNCTION",
-}
-var GoTest_KIND_value = map[string] int32 {
-	"VOID": 0,
-	"BOOL": 1,
-	"BYTES": 2,
-	"FINGERPRINT": 3,
-	"FLOAT": 4,
-	"INT": 5,
-	"STRING": 6,
-	"TIME": 7,
-	"TUPLE": 8,
-	"ARRAY": 9,
-	"MAP": 10,
-	"TABLE": 11,
-	"FUNCTION": 12,
+
+var GoTest_KIND_name = map[int32]string{
+	0:	"VOID",
+	1:	"BOOL",
+	2:	"BYTES",
+	3:	"FINGERPRINT",
+	4:	"FLOAT",
+	5:	"INT",
+	6:	"STRING",
+	7:	"TIME",
+	8:	"TUPLE",
+	9:	"ARRAY",
+	10:	"MAP",
+	11:	"TABLE",
+	12:	"FUNCTION",
+}
+var GoTest_KIND_value = map[string]int32{
+	"VOID":		0,
+	"BOOL":		1,
+	"BYTES":	2,
+	"FINGERPRINT":	3,
+	"FLOAT":	4,
+	"INT":		5,
+	"STRING":	6,
+	"TIME":		7,
+	"TUPLE":	8,
+	"ARRAY":	9,
+	"MAP":		10,
+	"TABLE":	11,
+	"FUNCTION":	12,
 }
+
 func NewGoTest_KIND(x int32) *GoTest_KIND {
 	e := GoTest_KIND(x)
 	return &e
 }
+func (x GoTest_KIND) String() string {
+	return proto.EnumName(GoTest_KIND_name, int32(x))
+}
 
 type MyMessage_Color int32
+
 const (
-	MyMessage_RED = 0
-	MyMessage_GREEN = 1
-	MyMessage_BLUE = 2
+	MyMessage_RED	= 0
+	MyMessage_GREEN	= 1
+	MyMessage_BLUE	= 2
 )
-var MyMessage_Color_name = map[int32] string {
-	0: "RED",
-	1: "GREEN",
-	2: "BLUE",
+
+var MyMessage_Color_name = map[int32]string{
+	0:	"RED",
+	1:	"GREEN",
+	2:	"BLUE",
 }
-var MyMessage_Color_value = map[string] int32 {
-	"RED": 0,
-	"GREEN": 1,
-	"BLUE": 2,
+var MyMessage_Color_value = map[string]int32{
+	"RED":		0,
+	"GREEN":	1,
+	"BLUE":		2,
 }
+
 func NewMyMessage_Color(x int32) *MyMessage_Color {
 	e := MyMessage_Color(x)
 	return &e
 }
+func (x MyMessage_Color) String() string {
+	return proto.EnumName(MyMessage_Color_name, int32(x))
+}
 
 type GoEnum struct {
-	Foo	*FOO	"PB(varint,1,req,name=foo,enum=test_proto.FOO)"
+	Foo			*FOO	`protobuf:"varint,1,req,name=foo,enum=test_proto.FOO"`
 	XXX_unrecognized	[]byte
 }
-func (this *GoEnum) Reset() {
-	*this = GoEnum{}
-}
-func NewGoEnum() *GoEnum {
-	return new(GoEnum)
-}
+
+func (this *GoEnum) Reset()		{ *this = GoEnum{} }
+func (this *GoEnum) String() string	{ return proto.CompactTextString(this) }
 
 type GoTestField struct {
-	Label	*string	"PB(bytes,1,req)"
-	Type	*string	"PB(bytes,2,req)"
+	Label			*string	`protobuf:"bytes,1,req"`
+	Type			*string	`protobuf:"bytes,2,req"`
 	XXX_unrecognized	[]byte
 }
-func (this *GoTestField) Reset() {
-	*this = GoTestField{}
-}
-func NewGoTestField() *GoTestField {
-	return new(GoTestField)
-}
+
+func (this *GoTestField) Reset()		{ *this = GoTestField{} }
+func (this *GoTestField) String() string	{ return proto.CompactTextString(this) }
 
 type GoTest struct {
-	Kind	*int32	"PB(varint,1,req)"
-	Table	*string	"PB(bytes,2,opt)"
-	Param	*int32	"PB(varint,3,opt)"
-	RequiredField	*GoTestField	"PB(bytes,4,req)"
-	RepeatedField	[]*GoTestField	"PB(bytes,5,rep)"
-	OptionalField	*GoTestField	"PB(bytes,6,opt)"
-	F_BoolRequired	*bool	"PB(varint,10,req,name=F_Bool_required)"
-	F_Int32Required	*int32	"PB(varint,11,req,name=F_Int32_required)"
-	F_Int64Required	*int64	"PB(varint,12,req,name=F_Int64_required)"
-	F_Fixed32Required	*uint32	"PB(fixed32,13,req,name=F_Fixed32_required)"
-	F_Fixed64Required	*uint64	"PB(fixed64,14,req,name=F_Fixed64_required)"
-	F_Uint32Required	*uint32	"PB(varint,15,req,name=F_Uint32_required)"
-	F_Uint64Required	*uint64	"PB(varint,16,req,name=F_Uint64_required)"
-	F_FloatRequired	*float32	"PB(fixed32,17,req,name=F_Float_required)"
-	F_DoubleRequired	*float64	"PB(fixed64,18,req,name=F_Double_required)"
-	F_StringRequired	*string	"PB(bytes,19,req,name=F_String_required)"
-	F_BytesRequired	[]byte	"PB(bytes,101,req,name=F_Bytes_required)"
-	F_Sint32Required	*int32	"PB(zigzag32,102,req,name=F_Sint32_required)"
-	F_Sint64Required	*int64	"PB(zigzag64,103,req,name=F_Sint64_required)"
-	F_BoolRepeated	[]bool	"PB(varint,20,rep,name=F_Bool_repeated)"
-	F_Int32Repeated	[]int32	"PB(varint,21,rep,name=F_Int32_repeated)"
-	F_Int64Repeated	[]int64	"PB(varint,22,rep,name=F_Int64_repeated)"
-	F_Fixed32Repeated	[]uint32	"PB(fixed32,23,rep,name=F_Fixed32_repeated)"
-	F_Fixed64Repeated	[]uint64	"PB(fixed64,24,rep,name=F_Fixed64_repeated)"
-	F_Uint32Repeated	[]uint32	"PB(varint,25,rep,name=F_Uint32_repeated)"
-	F_Uint64Repeated	[]uint64	"PB(varint,26,rep,name=F_Uint64_repeated)"
-	F_FloatRepeated	[]float32	"PB(fixed32,27,rep,name=F_Float_repeated)"
-	F_DoubleRepeated	[]float64	"PB(fixed64,28,rep,name=F_Double_repeated)"
-	F_StringRepeated	[]string	"PB(bytes,29,rep,name=F_String_repeated)"
-	F_BytesRepeated	[][]byte	"PB(bytes,201,rep,name=F_Bytes_repeated)"
-	F_Sint32Repeated	[]int32	"PB(zigzag32,202,rep,name=F_Sint32_repeated)"
-	F_Sint64Repeated	[]int64	"PB(zigzag64,203,rep,name=F_Sint64_repeated)"
-	F_BoolOptional	*bool	"PB(varint,30,opt,name=F_Bool_optional)"
-	F_Int32Optional	*int32	"PB(varint,31,opt,name=F_Int32_optional)"
-	F_Int64Optional	*int64	"PB(varint,32,opt,name=F_Int64_optional)"
-	F_Fixed32Optional	*uint32	"PB(fixed32,33,opt,name=F_Fixed32_optional)"
-	F_Fixed64Optional	*uint64	"PB(fixed64,34,opt,name=F_Fixed64_optional)"
-	F_Uint32Optional	*uint32	"PB(varint,35,opt,name=F_Uint32_optional)"
-	F_Uint64Optional	*uint64	"PB(varint,36,opt,name=F_Uint64_optional)"
-	F_FloatOptional	*float32	"PB(fixed32,37,opt,name=F_Float_optional)"
-	F_DoubleOptional	*float64	"PB(fixed64,38,opt,name=F_Double_optional)"
-	F_StringOptional	*string	"PB(bytes,39,opt,name=F_String_optional)"
-	F_BytesOptional	[]byte	"PB(bytes,301,opt,name=F_Bytes_optional)"
-	F_Sint32Optional	*int32	"PB(zigzag32,302,opt,name=F_Sint32_optional)"
-	F_Sint64Optional	*int64	"PB(zigzag64,303,opt,name=F_Sint64_optional)"
-	F_BoolDefaulted	*bool	"PB(varint,40,opt,name=F_Bool_defaulted,def=1)"
-	F_Int32Defaulted	*int32	"PB(varint,41,opt,name=F_Int32_defaulted,def=32)"
-	F_Int64Defaulted	*int64	"PB(varint,42,opt,name=F_Int64_defaulted,def=64)"
-	F_Fixed32Defaulted	*uint32	"PB(fixed32,43,opt,name=F_Fixed32_defaulted,def=320)"
-	F_Fixed64Defaulted	*uint64	"PB(fixed64,44,opt,name=F_Fixed64_defaulted,def=640)"
-	F_Uint32Defaulted	*uint32	"PB(varint,45,opt,name=F_Uint32_defaulted,def=3200)"
-	F_Uint64Defaulted	*uint64	"PB(varint,46,opt,name=F_Uint64_defaulted,def=6400)"
-	F_FloatDefaulted	*float32	"PB(fixed32,47,opt,name=F_Float_defaulted,def=314159)"
-	F_DoubleDefaulted	*float64	"PB(fixed64,48,opt,name=F_Double_defaulted,def=271828)"
-	F_StringDefaulted	*string	"PB(bytes,49,opt,name=F_String_defaulted,def=hello, \\\"world!\\\"\\n)"
-	F_BytesDefaulted	[]byte	"PB(bytes,401,opt,name=F_Bytes_defaulted,def=Bignose)"
-	F_Sint32Defaulted	*int32	"PB(zigzag32,402,opt,name=F_Sint32_defaulted,def=-32)"
-	F_Sint64Defaulted	*int64	"PB(zigzag64,403,opt,name=F_Sint64_defaulted,def=-64)"
-	Requiredgroup	*GoTest_RequiredGroup	"PB(group,70,req,name=requiredgroup)"
-	Repeatedgroup	[]*GoTest_RepeatedGroup	"PB(group,80,rep,name=repeatedgroup)"
-	Optionalgroup	*GoTest_OptionalGroup	"PB(group,90,opt,name=optionalgroup)"
+	Kind			*int32			`protobuf:"varint,1,req"`
+	Table			*string			`protobuf:"bytes,2,opt"`
+	Param			*int32			`protobuf:"varint,3,opt"`
+	RequiredField		*GoTestField		`protobuf:"bytes,4,req"`
+	RepeatedField		[]*GoTestField		`protobuf:"bytes,5,rep"`
+	OptionalField		*GoTestField		`protobuf:"bytes,6,opt"`
+	F_BoolRequired		*bool			`protobuf:"varint,10,req,name=F_Bool_required"`
+	F_Int32Required		*int32			`protobuf:"varint,11,req,name=F_Int32_required"`
+	F_Int64Required		*int64			`protobuf:"varint,12,req,name=F_Int64_required"`
+	F_Fixed32Required	*uint32			`protobuf:"fixed32,13,req,name=F_Fixed32_required"`
+	F_Fixed64Required	*uint64			`protobuf:"fixed64,14,req,name=F_Fixed64_required"`
+	F_Uint32Required	*uint32			`protobuf:"varint,15,req,name=F_Uint32_required"`
+	F_Uint64Required	*uint64			`protobuf:"varint,16,req,name=F_Uint64_required"`
+	F_FloatRequired		*float32		`protobuf:"fixed32,17,req,name=F_Float_required"`
+	F_DoubleRequired	*float64		`protobuf:"fixed64,18,req,name=F_Double_required"`
+	F_StringRequired	*string			`protobuf:"bytes,19,req,name=F_String_required"`
+	F_BytesRequired		[]byte			`protobuf:"bytes,101,req,name=F_Bytes_required"`
+	F_Sint32Required	*int32			`protobuf:"zigzag32,102,req,name=F_Sint32_required"`
+	F_Sint64Required	*int64			`protobuf:"zigzag64,103,req,name=F_Sint64_required"`
+	F_BoolRepeated		[]bool			`protobuf:"varint,20,rep,name=F_Bool_repeated"`
+	F_Int32Repeated		[]int32			`protobuf:"varint,21,rep,name=F_Int32_repeated"`
+	F_Int64Repeated		[]int64			`protobuf:"varint,22,rep,name=F_Int64_repeated"`
+	F_Fixed32Repeated	[]uint32		`protobuf:"fixed32,23,rep,name=F_Fixed32_repeated"`
+	F_Fixed64Repeated	[]uint64		`protobuf:"fixed64,24,rep,name=F_Fixed64_repeated"`
+	F_Uint32Repeated	[]uint32		`protobuf:"varint,25,rep,name=F_Uint32_repeated"`
+	F_Uint64Repeated	[]uint64		`protobuf:"varint,26,rep,name=F_Uint64_repeated"`
+	F_FloatRepeated		[]float32		`protobuf:"fixed32,27,rep,name=F_Float_repeated"`
+	F_DoubleRepeated	[]float64		`protobuf:"fixed64,28,rep,name=F_Double_repeated"`
+	F_StringRepeated	[]string		`protobuf:"bytes,29,rep,name=F_String_repeated"`
+	F_BytesRepeated		[][]byte		`protobuf:"bytes,201,rep,name=F_Bytes_repeated"`
+	F_Sint32Repeated	[]int32			`protobuf:"zigzag32,202,rep,name=F_Sint32_repeated"`
+	F_Sint64Repeated	[]int64			`protobuf:"zigzag64,203,rep,name=F_Sint64_repeated"`
+	F_BoolOptional		*bool			`protobuf:"varint,30,opt,name=F_Bool_optional"`
+	F_Int32Optional		*int32			`protobuf:"varint,31,opt,name=F_Int32_optional"`
+	F_Int64Optional		*int64			`protobuf:"varint,32,opt,name=F_Int64_optional"`
+	F_Fixed32Optional	*uint32			`protobuf:"fixed32,33,opt,name=F_Fixed32_optional"`
+	F_Fixed64Optional	*uint64			`protobuf:"fixed64,34,opt,name=F_Fixed64_optional"`
+	F_Uint32Optional	*uint32			`protobuf:"varint,35,opt,name=F_Uint32_optional"`
+	F_Uint64Optional	*uint64			`protobuf:"varint,36,opt,name=F_Uint64_optional"`
+	F_FloatOptional		*float32		`protobuf:"fixed32,37,opt,name=F_Float_optional"`
+	F_DoubleOptional	*float64		`protobuf:"fixed64,38,opt,name=F_Double_optional"`
+	F_StringOptional	*string			`protobuf:"bytes,39,opt,name=F_String_optional"`
+	F_BytesOptional		[]byte			`protobuf:"bytes,301,opt,name=F_Bytes_optional"`
+	F_Sint32Optional	*int32			`protobuf:"zigzag32,302,opt,name=F_Sint32_optional"`
+	F_Sint64Optional	*int64			`protobuf:"zigzag64,303,opt,name=F_Sint64_optional"`
+	F_BoolDefaulted		*bool			`protobuf:"varint,40,opt,name=F_Bool_defaulted,def=1"`
+	F_Int32Defaulted	*int32			`protobuf:"varint,41,opt,name=F_Int32_defaulted,def=32"`
+	F_Int64Defaulted	*int64			`protobuf:"varint,42,opt,name=F_Int64_defaulted,def=64"`
+	F_Fixed32Defaulted	*uint32			`protobuf:"fixed32,43,opt,name=F_Fixed32_defaulted,def=320"`
+	F_Fixed64Defaulted	*uint64			`protobuf:"fixed64,44,opt,name=F_Fixed64_defaulted,def=640"`
+	F_Uint32Defaulted	*uint32			`protobuf:"varint,45,opt,name=F_Uint32_defaulted,def=3200"`
+	F_Uint64Defaulted	*uint64			`protobuf:"varint,46,opt,name=F_Uint64_defaulted,def=6400"`
+	F_FloatDefaulted	*float32		`protobuf:"fixed32,47,opt,name=F_Float_defaulted,def=314159"`
+	F_DoubleDefaulted	*float64		`protobuf:"fixed64,48,opt,name=F_Double_defaulted,def=271828"`
+	F_StringDefaulted	*string			`protobuf:"bytes,49,opt,name=F_String_defaulted,def=hello, \\\"world!\\\"\\n"`
+	F_BytesDefaulted	[]byte			`protobuf:"bytes,401,opt,name=F_Bytes_defaulted,def=Bignose"`
+	F_Sint32Defaulted	*int32			`protobuf:"zigzag32,402,opt,name=F_Sint32_defaulted,def=-32"`
+	F_Sint64Defaulted	*int64			`protobuf:"zigzag64,403,opt,name=F_Sint64_defaulted,def=-64"`
+	F_BoolRepeatedPacked	[]bool			`protobuf:"varint,50,rep,packed,name=F_Bool_repeated_packed"`
+	F_Int32RepeatedPacked	[]int32			`protobuf:"varint,51,rep,packed,name=F_Int32_repeated_packed"`
+	F_Int64RepeatedPacked	[]int64			`protobuf:"varint,52,rep,packed,name=F_Int64_repeated_packed"`
+	F_Fixed32RepeatedPacked	[]uint32		`protobuf:"fixed32,53,rep,packed,name=F_Fixed32_repeated_packed"`
+	F_Fixed64RepeatedPacked	[]uint64		`protobuf:"fixed64,54,rep,packed,name=F_Fixed64_repeated_packed"`
+	F_Uint32RepeatedPacked	[]uint32		`protobuf:"varint,55,rep,packed,name=F_Uint32_repeated_packed"`
+	F_Uint64RepeatedPacked	[]uint64		`protobuf:"varint,56,rep,packed,name=F_Uint64_repeated_packed"`
+	F_FloatRepeatedPacked	[]float32		`protobuf:"fixed32,57,rep,packed,name=F_Float_repeated_packed"`
+	F_DoubleRepeatedPacked	[]float64		`protobuf:"fixed64,58,rep,packed,name=F_Double_repeated_packed"`
+	F_Sint32RepeatedPacked	[]int32			`protobuf:"zigzag32,502,rep,packed,name=F_Sint32_repeated_packed"`
+	F_Sint64RepeatedPacked	[]int64			`protobuf:"zigzag64,503,rep,packed,name=F_Sint64_repeated_packed"`
+	Requiredgroup		*GoTest_RequiredGroup	`protobuf:"group,70,req,name=RequiredGroup"`
+	Repeatedgroup		[]*GoTest_RepeatedGroup	`protobuf:"group,80,rep,name=RepeatedGroup"`
+	Optionalgroup		*GoTest_OptionalGroup	`protobuf:"group,90,opt,name=OptionalGroup"`
 	XXX_unrecognized	[]byte
 }
-func (this *GoTest) Reset() {
-	*this = GoTest{}
-}
-func NewGoTest() *GoTest {
-	return new(GoTest)
-}
+
+func (this *GoTest) Reset()		{ *this = GoTest{} }
+func (this *GoTest) String() string	{ return proto.CompactTextString(this) }
+
 const Default_GoTest_F_BoolDefaulted bool = true
 const Default_GoTest_F_Int32Defaulted int32 = 32
 const Default_GoTest_F_Int64Defaulted int64 = 64
@@ -198,140 +224,170 @@ const Default_GoTest_F_Uint64Defaulted uint64 = 6400
 const Default_GoTest_F_FloatDefaulted float32 = 314159
 const Default_GoTest_F_DoubleDefaulted float64 = 271828
 const Default_GoTest_F_StringDefaulted string = "hello, \"world!\"\n"
+
 var Default_GoTest_F_BytesDefaulted []byte = []byte("Bignose")
+
 const Default_GoTest_F_Sint32Defaulted int32 = -32
 const Default_GoTest_F_Sint64Defaulted int64 = -64
 
 type GoTest_RequiredGroup struct {
-	RequiredField	*string	"PB(bytes,71,req)"
+	RequiredField		*string	`protobuf:"bytes,71,req"`
 	XXX_unrecognized	[]byte
 }
-func (this *GoTest_RequiredGroup) Reset() {
-	*this = GoTest_RequiredGroup{}
-}
-func NewGoTest_RequiredGroup() *GoTest_RequiredGroup {
-	return new(GoTest_RequiredGroup)
-}
+
+func (this *GoTest_RequiredGroup) Reset()		{ *this = GoTest_RequiredGroup{} }
+func (this *GoTest_RequiredGroup) String() string	{ return proto.CompactTextString(this) }
 
 type GoTest_RepeatedGroup struct {
-	RequiredField	*string	"PB(bytes,81,req)"
+	RequiredField		*string	`protobuf:"bytes,81,req"`
 	XXX_unrecognized	[]byte
 }
-func (this *GoTest_RepeatedGroup) Reset() {
-	*this = GoTest_RepeatedGroup{}
-}
-func NewGoTest_RepeatedGroup() *GoTest_RepeatedGroup {
-	return new(GoTest_RepeatedGroup)
-}
+
+func (this *GoTest_RepeatedGroup) Reset()		{ *this = GoTest_RepeatedGroup{} }
+func (this *GoTest_RepeatedGroup) String() string	{ return proto.CompactTextString(this) }
 
 type GoTest_OptionalGroup struct {
-	RequiredField	*string	"PB(bytes,91,req)"
+	RequiredField		*string	`protobuf:"bytes,91,req"`
 	XXX_unrecognized	[]byte
 }
-func (this *GoTest_OptionalGroup) Reset() {
-	*this = GoTest_OptionalGroup{}
-}
-func NewGoTest_OptionalGroup() *GoTest_OptionalGroup {
-	return new(GoTest_OptionalGroup)
-}
+
+func (this *GoTest_OptionalGroup) Reset()		{ *this = GoTest_OptionalGroup{} }
+func (this *GoTest_OptionalGroup) String() string	{ return proto.CompactTextString(this) }
 
 type GoSkipTest struct {
-	SkipInt32	*int32	"PB(varint,11,req,name=skip_int32)"
-	SkipFixed32	*uint32	"PB(fixed32,12,req,name=skip_fixed32)"
-	SkipFixed64	*uint64	"PB(fixed64,13,req,name=skip_fixed64)"
-	SkipString	*string	"PB(bytes,14,req,name=skip_string)"
-	Skipgroup	*GoSkipTest_SkipGroup	"PB(group,15,req,name=skipgroup)"
+	SkipInt32		*int32			`protobuf:"varint,11,req,name=skip_int32"`
+	SkipFixed32		*uint32			`protobuf:"fixed32,12,req,name=skip_fixed32"`
+	SkipFixed64		*uint64			`protobuf:"fixed64,13,req,name=skip_fixed64"`
+	SkipString		*string			`protobuf:"bytes,14,req,name=skip_string"`
+	Skipgroup		*GoSkipTest_SkipGroup	`protobuf:"group,15,req,name=SkipGroup"`
 	XXX_unrecognized	[]byte
 }
-func (this *GoSkipTest) Reset() {
-	*this = GoSkipTest{}
-}
-func NewGoSkipTest() *GoSkipTest {
-	return new(GoSkipTest)
-}
+
+func (this *GoSkipTest) Reset()		{ *this = GoSkipTest{} }
+func (this *GoSkipTest) String() string	{ return proto.CompactTextString(this) }
 
 type GoSkipTest_SkipGroup struct {
-	GroupInt32	*int32	"PB(varint,16,req,name=group_int32)"
-	GroupString	*string	"PB(bytes,17,req,name=group_string)"
+	GroupInt32		*int32	`protobuf:"varint,16,req,name=group_int32"`
+	GroupString		*string	`protobuf:"bytes,17,req,name=group_string"`
 	XXX_unrecognized	[]byte
 }
-func (this *GoSkipTest_SkipGroup) Reset() {
-	*this = GoSkipTest_SkipGroup{}
+
+func (this *GoSkipTest_SkipGroup) Reset()		{ *this = GoSkipTest_SkipGroup{} }
+func (this *GoSkipTest_SkipGroup) String() string	{ return proto.CompactTextString(this) }
+
+type NonPackedTest struct {
+	A			[]int32	`protobuf:"varint,1,rep,name=a"`
+	XXX_unrecognized	[]byte
 }
-func NewGoSkipTest_SkipGroup() *GoSkipTest_SkipGroup {
-	return new(GoSkipTest_SkipGroup)
+
+func (this *NonPackedTest) Reset()		{ *this = NonPackedTest{} }
+func (this *NonPackedTest) String() string	{ return proto.CompactTextString(this) }
+
+type PackedTest struct {
+	B			[]int32	`protobuf:"varint,1,rep,packed,name=b"`
+	XXX_unrecognized	[]byte
 }
 
+func (this *PackedTest) Reset()		{ *this = PackedTest{} }
+func (this *PackedTest) String() string	{ return proto.CompactTextString(this) }
+
 type InnerMessage struct {
-	Host	*string	"PB(bytes,1,req,name=host)"
-	Port	*int32	"PB(varint,2,opt,name=port,def=4000)"
-	Connected	*bool	"PB(varint,3,opt,name=connected)"
+	Host			*string	`protobuf:"bytes,1,req,name=host"`
+	Port			*int32	`protobuf:"varint,2,opt,name=port,def=4000"`
+	Connected		*bool	`protobuf:"varint,3,opt,name=connected"`
 	XXX_unrecognized	[]byte
 }
-func (this *InnerMessage) Reset() {
-	*this = InnerMessage{}
-}
-func NewInnerMessage() *InnerMessage {
-	return new(InnerMessage)
-}
+
+func (this *InnerMessage) Reset()		{ *this = InnerMessage{} }
+func (this *InnerMessage) String() string	{ return proto.CompactTextString(this) }
+
 const Default_InnerMessage_Port int32 = 4000
 
 type OtherMessage struct {
-	Key	*int64	"PB(varint,1,opt,name=key)"
-	Value	[]byte	"PB(bytes,2,opt,name=value)"
-	Weight	*float32	"PB(fixed32,3,opt,name=weight)"
-	Inner	*InnerMessage	"PB(bytes,4,opt,name=inner)"
+	Key			*int64		`protobuf:"varint,1,opt,name=key"`
+	Value			[]byte		`protobuf:"bytes,2,opt,name=value"`
+	Weight			*float32	`protobuf:"fixed32,3,opt,name=weight"`
+	Inner			*InnerMessage	`protobuf:"bytes,4,opt,name=inner"`
 	XXX_unrecognized	[]byte
 }
-func (this *OtherMessage) Reset() {
-	*this = OtherMessage{}
-}
-func NewOtherMessage() *OtherMessage {
-	return new(OtherMessage)
-}
+
+func (this *OtherMessage) Reset()		{ *this = OtherMessage{} }
+func (this *OtherMessage) String() string	{ return proto.CompactTextString(this) }
 
 type MyMessage struct {
-	Count	*int32	"PB(varint,1,req,name=count)"
-	Name	*string	"PB(bytes,2,opt,name=name)"
-	Quote	*string	"PB(bytes,3,opt,name=quote)"
-	Pet	[]string	"PB(bytes,4,rep,name=pet)"
-	Inner	*InnerMessage	"PB(bytes,5,opt,name=inner)"
-	Others	[]*OtherMessage	"PB(bytes,6,rep,name=others)"
-	Bikeshed	*MyMessage_Color	"PB(varint,7,opt,name=bikeshed,enum=test_proto.MyMessage_Color)"
+	Count			*int32			`protobuf:"varint,1,req,name=count"`
+	Name			*string			`protobuf:"bytes,2,opt,name=name"`
+	Quote			*string			`protobuf:"bytes,3,opt,name=quote"`
+	Pet			[]string		`protobuf:"bytes,4,rep,name=pet"`
+	Inner			*InnerMessage		`protobuf:"bytes,5,opt,name=inner"`
+	Others			[]*OtherMessage		`protobuf:"bytes,6,rep,name=others"`
+	Bikeshed		*MyMessage_Color	`protobuf:"varint,7,opt,name=bikeshed,enum=test_proto.MyMessage_Color"`
+	Somegroup		*MyMessage_SomeGroup	`protobuf:"group,8,opt,name=SomeGroup"`
+	XXX_extensions		map[int32][]byte
 	XXX_unrecognized	[]byte
 }
-func (this *MyMessage) Reset() {
-	*this = MyMessage{}
+
+func (this *MyMessage) Reset()		{ *this = MyMessage{} }
+func (this *MyMessage) String() string	{ return proto.CompactTextString(this) }
+
+var extRange_MyMessage = []proto.ExtensionRange{
+	proto.ExtensionRange{100, 536870911},
+}
+
+func (*MyMessage) ExtensionRangeArray() []proto.ExtensionRange {
+	return extRange_MyMessage
 }
-func NewMyMessage() *MyMessage {
-	return new(MyMessage)
+func (this *MyMessage) ExtensionMap() map[int32][]byte {
+	if this.XXX_extensions == nil {
+		this.XXX_extensions = make(map[int32][]byte)
+	}
+	return this.XXX_extensions
 }
 
-type MessageList struct {
-	Message	[]*MessageList_Message	"PB(group,1,rep,name=message)"
+type MyMessage_SomeGroup struct {
+	GroupField		*int32	`protobuf:"varint,9,opt,name=group_field"`
 	XXX_unrecognized	[]byte
 }
-func (this *MessageList) Reset() {
-	*this = MessageList{}
+
+func (this *MyMessage_SomeGroup) Reset()		{ *this = MyMessage_SomeGroup{} }
+func (this *MyMessage_SomeGroup) String() string	{ return proto.CompactTextString(this) }
+
+type Ext struct {
+	Data			*string	`protobuf:"bytes,1,opt,name=data"`
+	XXX_unrecognized	[]byte
 }
-func NewMessageList() *MessageList {
-	return new(MessageList)
+
+func (this *Ext) Reset()		{ *this = Ext{} }
+func (this *Ext) String() string	{ return proto.CompactTextString(this) }
+
+var E_Ext_More = &proto.ExtensionDesc{
+	ExtendedType:	(*MyMessage)(nil),
+	ExtensionType:	(*Ext)(nil),
+	Field:		103,
+	Name:		"test_proto.more",
+	Tag:		"bytes,103,opt,name=more",
 }
 
-type MessageList_Message struct {
-	Name	*string	"PB(bytes,2,req,name=name)"
-	Count	*int32	"PB(varint,3,req,name=count)"
+type MessageList struct {
+	Message			[]*MessageList_Message	`protobuf:"group,1,rep"`
 	XXX_unrecognized	[]byte
 }
-func (this *MessageList_Message) Reset() {
-	*this = MessageList_Message{}
-}
-func NewMessageList_Message() *MessageList_Message {
-	return new(MessageList_Message)
+
+func (this *MessageList) Reset()		{ *this = MessageList{} }
+func (this *MessageList) String() string	{ return proto.CompactTextString(this) }
+
+type MessageList_Message struct {
+	Name			*string	`protobuf:"bytes,2,req,name=name"`
+	Count			*int32	`protobuf:"varint,3,req,name=count"`
+	XXX_unrecognized	[]byte
 }
 
+func (this *MessageList_Message) Reset()		{ *this = MessageList_Message{} }
+func (this *MessageList_Message) String() string	{ return proto.CompactTextString(this) }
+
 func init() {
 	proto.RegisterEnum("test_proto.FOO", FOO_name, FOO_value)
 	proto.RegisterEnum("test_proto.GoTest_KIND", GoTest_KIND_name, GoTest_KIND_value)
 	proto.RegisterEnum("test_proto.MyMessage_Color", MyMessage_Color_name, MyMessage_Color_value)
+	proto.RegisterExtension(E_Ext_More)
 }

+ 1 - 1
proto/text.go

@@ -58,7 +58,7 @@ type textWriter struct {
 func (w *textWriter) Write(p []byte) (n int, err os.Error) {
 	n, err = len(p), nil
 
-	frags := strings.Split(string(p), "\n", -1)
+	frags := strings.Split(string(p), "\n")
 	if w.compact {
 		w.writer.Write([]byte(strings.Join(frags, " ")))
 		return