Regenerate descriptor.pb.go and plugin.pb.go.
Fix uses of long-gone NewT in generator.go.
R=r
CC=golang-dev
http://codereview.appspot.com/2954041
diff --git a/compiler/descriptor/Makefile b/compiler/descriptor/Makefile
index 72c4071..ae052d6 100644
--- a/compiler/descriptor/Makefile
+++ b/compiler/descriptor/Makefile
@@ -41,7 +41,6 @@
# Not stored here, but descriptor.proto is in http://code.google.com/p/protobuf
# at protobuf-2.3.0/src/google/protobuf/descriptor.proto
-# Also we need to fix an import.
regenerate:
echo WARNING! THIS RULE IS PROBABLY NOT RIGHT FOR YOUR INSTALLATION
cd $(HOME)/protobuf-2.3.0/src && \
diff --git a/compiler/descriptor/descriptor.pb.go b/compiler/descriptor/descriptor.pb.go
index dc7e4a6..258a602 100644
--- a/compiler/descriptor/descriptor.pb.go
+++ b/compiler/descriptor/descriptor.pb.go
@@ -3,7 +3,10 @@
package google_protobuf
-import "goprotobuf.googlecode.com/hg/proto"
+import proto "goprotobuf.googlecode.com/hg/proto"
+
+// Reference proto import to suppress error if it's not otherwise used.
+var _ = proto.GetString
type FieldDescriptorProto_Type int32
const (
@@ -141,9 +144,6 @@
func (this *FileDescriptorSet) Reset() {
*this = FileDescriptorSet{}
}
-func NewFileDescriptorSet() *FileDescriptorSet {
- return new(FileDescriptorSet)
-}
type FileDescriptorProto struct {
Name *string "PB(bytes,1,opt,name=name)"
@@ -154,14 +154,12 @@
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{}
}
-func NewFileDescriptorProto() *FileDescriptorProto {
- return new(FileDescriptorProto)
-}
type DescriptorProto struct {
Name *string "PB(bytes,1,opt,name=name)"
@@ -176,9 +174,6 @@
func (this *DescriptorProto) Reset() {
*this = DescriptorProto{}
}
-func NewDescriptorProto() *DescriptorProto {
- return new(DescriptorProto)
-}
type DescriptorProto_ExtensionRange struct {
Start *int32 "PB(varint,1,opt,name=start)"
@@ -188,9 +183,6 @@
func (this *DescriptorProto_ExtensionRange) Reset() {
*this = DescriptorProto_ExtensionRange{}
}
-func NewDescriptorProto_ExtensionRange() *DescriptorProto_ExtensionRange {
- return new(DescriptorProto_ExtensionRange)
-}
type FieldDescriptorProto struct {
Name *string "PB(bytes,1,opt,name=name)"
@@ -206,9 +198,6 @@
func (this *FieldDescriptorProto) Reset() {
*this = FieldDescriptorProto{}
}
-func NewFieldDescriptorProto() *FieldDescriptorProto {
- return new(FieldDescriptorProto)
-}
type EnumDescriptorProto struct {
Name *string "PB(bytes,1,opt,name=name)"
@@ -219,9 +208,6 @@
func (this *EnumDescriptorProto) Reset() {
*this = EnumDescriptorProto{}
}
-func NewEnumDescriptorProto() *EnumDescriptorProto {
- return new(EnumDescriptorProto)
-}
type EnumValueDescriptorProto struct {
Name *string "PB(bytes,1,opt,name=name)"
@@ -232,9 +218,6 @@
func (this *EnumValueDescriptorProto) Reset() {
*this = EnumValueDescriptorProto{}
}
-func NewEnumValueDescriptorProto() *EnumValueDescriptorProto {
- return new(EnumValueDescriptorProto)
-}
type ServiceDescriptorProto struct {
Name *string "PB(bytes,1,opt,name=name)"
@@ -245,9 +228,6 @@
func (this *ServiceDescriptorProto) Reset() {
*this = ServiceDescriptorProto{}
}
-func NewServiceDescriptorProto() *ServiceDescriptorProto {
- return new(ServiceDescriptorProto)
-}
type MethodDescriptorProto struct {
Name *string "PB(bytes,1,opt,name=name)"
@@ -259,44 +239,65 @@
func (this *MethodDescriptorProto) Reset() {
*this = MethodDescriptorProto{}
}
-func NewMethodDescriptorProto() *MethodDescriptorProto {
- return new(MethodDescriptorProto)
-}
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=1)"
- JavaGenericServices *bool "PB(varint,17,opt,name=java_generic_services,def=1)"
- PyGenericServices *bool "PB(varint,18,opt,name=py_generic_services,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{}
}
-func NewFileOptions() *FileOptions {
- return new(FileOptions)
+
+var extRange_FileOptions = []proto.ExtensionRange{
+ proto.ExtensionRange{1000, 536870911},
+}
+func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange {
+ return extRange_FileOptions
+}
+func (this *FileOptions) ExtensionMap() map[int32][]byte {
+ if this.XXX_extensions == nil {
+ this.XXX_extensions = make(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 = true
-const Default_FileOptions_JavaGenericServices bool = true
-const Default_FileOptions_PyGenericServices bool = true
+const Default_FileOptions_CcGenericServices bool = false
+const Default_FileOptions_JavaGenericServices bool = false
+const Default_FileOptions_PyGenericServices bool = false
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{}
}
-func NewMessageOptions() *MessageOptions {
- return new(MessageOptions)
+
+var extRange_MessageOptions = []proto.ExtensionRange{
+ proto.ExtensionRange{1000, 536870911},
+}
+func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange {
+ return extRange_MessageOptions
+}
+func (this *MessageOptions) ExtensionMap() map[int32][]byte {
+ if this.XXX_extensions == nil {
+ this.XXX_extensions = make(map[int32][]byte)
+ }
+ return this.XXX_extensions
}
const Default_MessageOptions_MessageSetWireFormat bool = false
const Default_MessageOptions_NoStandardDescriptorAccessor bool = false
@@ -307,59 +308,114 @@
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{}
}
-func NewFieldOptions() *FieldOptions {
- return new(FieldOptions)
+
+var extRange_FieldOptions = []proto.ExtensionRange{
+ proto.ExtensionRange{1000, 536870911},
+}
+func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange {
+ return extRange_FieldOptions
+}
+func (this *FieldOptions) ExtensionMap() map[int32][]byte {
+ if this.XXX_extensions == nil {
+ this.XXX_extensions = make(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{}
}
-func NewEnumOptions() *EnumOptions {
- return new(EnumOptions)
+
+var extRange_EnumOptions = []proto.ExtensionRange{
+ proto.ExtensionRange{1000, 536870911},
+}
+func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange {
+ return extRange_EnumOptions
+}
+func (this *EnumOptions) ExtensionMap() map[int32][]byte {
+ if this.XXX_extensions == nil {
+ this.XXX_extensions = make(map[int32][]byte)
+ }
+ return this.XXX_extensions
}
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{}
}
-func NewEnumValueOptions() *EnumValueOptions {
- return new(EnumValueOptions)
+
+var extRange_EnumValueOptions = []proto.ExtensionRange{
+ proto.ExtensionRange{1000, 536870911},
+}
+func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange {
+ return extRange_EnumValueOptions
+}
+func (this *EnumValueOptions) ExtensionMap() map[int32][]byte {
+ if this.XXX_extensions == nil {
+ this.XXX_extensions = make(map[int32][]byte)
+ }
+ return this.XXX_extensions
}
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{}
}
-func NewServiceOptions() *ServiceOptions {
- return new(ServiceOptions)
+
+var extRange_ServiceOptions = []proto.ExtensionRange{
+ proto.ExtensionRange{1000, 536870911},
+}
+func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange {
+ return extRange_ServiceOptions
+}
+func (this *ServiceOptions) ExtensionMap() map[int32][]byte {
+ if this.XXX_extensions == nil {
+ this.XXX_extensions = make(map[int32][]byte)
+ }
+ return this.XXX_extensions
}
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{}
}
-func NewMethodOptions() *MethodOptions {
- return new(MethodOptions)
+
+var extRange_MethodOptions = []proto.ExtensionRange{
+ proto.ExtensionRange{1000, 536870911},
+}
+func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange {
+ return extRange_MethodOptions
+}
+func (this *MethodOptions) ExtensionMap() map[int32][]byte {
+ if this.XXX_extensions == nil {
+ this.XXX_extensions = make(map[int32][]byte)
+ }
+ return this.XXX_extensions
}
type UninterpretedOption struct {
@@ -369,14 +425,12 @@
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{}
}
-func NewUninterpretedOption() *UninterpretedOption {
- return new(UninterpretedOption)
-}
type UninterpretedOption_NamePart struct {
NamePart *string "PB(bytes,1,req,name=name_part)"
@@ -386,8 +440,22 @@
func (this *UninterpretedOption_NamePart) Reset() {
*this = UninterpretedOption_NamePart{}
}
-func NewUninterpretedOption_NamePart() *UninterpretedOption_NamePart {
- return new(UninterpretedOption_NamePart)
+
+type SourceCodeInfo struct {
+ Location []*SourceCodeInfo_Location "PB(bytes,1,rep,name=location)"
+ XXX_unrecognized []byte
+}
+func (this *SourceCodeInfo) Reset() {
+ *this = SourceCodeInfo{}
+}
+
+type SourceCodeInfo_Location struct {
+ Path []int32 "PB(varint,1,rep,name=path)"
+ Span []int32 "PB(varint,2,rep,name=span)"
+ XXX_unrecognized []byte
+}
+func (this *SourceCodeInfo_Location) Reset() {
+ *this = SourceCodeInfo_Location{}
}
func init() {
diff --git a/compiler/generator/generator.go b/compiler/generator/generator.go
index 2f9aebe..e53580a 100644
--- a/compiler/generator/generator.go
+++ b/compiler/generator/generator.go
@@ -261,8 +261,8 @@
func New() *Generator {
g := new(Generator)
g.Buffer = new(bytes.Buffer)
- g.Request = plugin.NewCodeGeneratorRequest()
- g.Response = plugin.NewCodeGeneratorResponse()
+ g.Request = new(plugin.CodeGeneratorRequest)
+ g.Response = new(plugin.CodeGeneratorResponse)
return g
}
@@ -564,7 +564,7 @@
for i, file := range g.genFiles {
g.Reset()
g.generate(file)
- g.Response.File[i] = plugin.NewCodeGeneratorResponse_File()
+ g.Response.File[i] = new(plugin.CodeGeneratorResponse_File)
g.Response.File[i].Name = proto.String(goFileName(*file.Name))
g.Response.File[i].Content = proto.String(g.String())
}
diff --git a/compiler/plugin/plugin.pb.go b/compiler/plugin/plugin.pb.go
index 1c11686..1f0188c 100644
--- a/compiler/plugin/plugin.pb.go
+++ b/compiler/plugin/plugin.pb.go
@@ -3,8 +3,12 @@
package google_protobuf_compiler
+import proto "goprotobuf.googlecode.com/hg/proto"
import google_protobuf "goprotobuf.googlecode.com/hg/compiler/descriptor"
+// Reference proto import to suppress error if it's not otherwise used.
+var _ = proto.GetString
+
type CodeGeneratorRequest struct {
FileToGenerate []string "PB(bytes,1,rep,name=file_to_generate)"
Parameter *string "PB(bytes,2,opt,name=parameter)"
@@ -14,9 +18,6 @@
func (this *CodeGeneratorRequest) Reset() {
*this = CodeGeneratorRequest{}
}
-func NewCodeGeneratorRequest() *CodeGeneratorRequest {
- return new(CodeGeneratorRequest)
-}
type CodeGeneratorResponse struct {
Error *string "PB(bytes,1,opt,name=error)"
@@ -26,9 +27,6 @@
func (this *CodeGeneratorResponse) Reset() {
*this = CodeGeneratorResponse{}
}
-func NewCodeGeneratorResponse() *CodeGeneratorResponse {
- return new(CodeGeneratorResponse)
-}
type CodeGeneratorResponse_File struct {
Name *string "PB(bytes,1,opt,name=name)"
@@ -39,9 +37,6 @@
func (this *CodeGeneratorResponse_File) Reset() {
*this = CodeGeneratorResponse_File{}
}
-func NewCodeGeneratorResponse_File() *CodeGeneratorResponse_File {
- return new(CodeGeneratorResponse_File)
-}
func init() {
}