mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-02-10 12:39:48 +00:00
internal/fieldnum: generate field numbers for the google.protobuf package
Generate field numbers for the well-known types, so that encoding/jsonpb can benefit from them as well. This CL fixes internal/cmd/generate-protos, which was silently failing because the modulePath was not properly initialized. We fix this by moving it to the start of the init function. Change-Id: I87637176f29218cffa512b4baa49f39dae924061 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/168497 Reviewed-by: Herbie Ong <herbie@google.com>
This commit is contained in:
parent
0b0f4036db
commit
ca46d8c924
@ -10,7 +10,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/golang/protobuf/v2/internal/descfield"
|
"github.com/golang/protobuf/v2/internal/fieldnum"
|
||||||
"github.com/golang/protobuf/v2/internal/scalar"
|
"github.com/golang/protobuf/v2/internal/scalar"
|
||||||
|
|
||||||
descriptorpb "github.com/golang/protobuf/v2/types/descriptor"
|
descriptorpb "github.com/golang/protobuf/v2/types/descriptor"
|
||||||
@ -36,19 +36,19 @@ func TestAnnotations(t *testing.T) {
|
|||||||
path []int32
|
path []int32
|
||||||
}{{
|
}{{
|
||||||
"type ", "AnnotationsTestEnum", " int32",
|
"type ", "AnnotationsTestEnum", " int32",
|
||||||
[]int32{descfield.FileDescriptorProto_EnumType, 0},
|
[]int32{fieldnum.FileDescriptorProto_EnumType, 0},
|
||||||
}, {
|
}, {
|
||||||
"\t", "AnnotationsTestEnum_ANNOTATIONS_TEST_ENUM_VALUE", " AnnotationsTestEnum = 0",
|
"\t", "AnnotationsTestEnum_ANNOTATIONS_TEST_ENUM_VALUE", " AnnotationsTestEnum = 0",
|
||||||
[]int32{descfield.FileDescriptorProto_EnumType, 0, descfield.EnumDescriptorProto_Value, 0},
|
[]int32{fieldnum.FileDescriptorProto_EnumType, 0, fieldnum.EnumDescriptorProto_Value, 0},
|
||||||
}, {
|
}, {
|
||||||
"type ", "AnnotationsTestMessage", " struct {",
|
"type ", "AnnotationsTestMessage", " struct {",
|
||||||
[]int32{descfield.FileDescriptorProto_MessageType, 0},
|
[]int32{fieldnum.FileDescriptorProto_MessageType, 0},
|
||||||
}, {
|
}, {
|
||||||
"\t", "AnnotationsTestField", " ",
|
"\t", "AnnotationsTestField", " ",
|
||||||
[]int32{descfield.FileDescriptorProto_MessageType, 0, descfield.DescriptorProto_Field, 0},
|
[]int32{fieldnum.FileDescriptorProto_MessageType, 0, fieldnum.DescriptorProto_Field, 0},
|
||||||
}, {
|
}, {
|
||||||
"func (m *AnnotationsTestMessage) ", "GetAnnotationsTestField", "() string {",
|
"func (m *AnnotationsTestMessage) ", "GetAnnotationsTestField", "() string {",
|
||||||
[]int32{descfield.FileDescriptorProto_MessageType, 0, descfield.DescriptorProto_Field, 0},
|
[]int32{fieldnum.FileDescriptorProto_MessageType, 0, fieldnum.DescriptorProto_Field, 0},
|
||||||
}} {
|
}} {
|
||||||
s := want.prefix + want.text + want.suffix
|
s := want.prefix + want.text + want.suffix
|
||||||
pos := bytes.Index(sourceFile, []byte(s))
|
pos := bytes.Index(sourceFile, []byte(s))
|
||||||
|
@ -17,8 +17,8 @@ import (
|
|||||||
"unicode"
|
"unicode"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"github.com/golang/protobuf/v2/internal/descfield"
|
|
||||||
"github.com/golang/protobuf/v2/internal/encoding/tag"
|
"github.com/golang/protobuf/v2/internal/encoding/tag"
|
||||||
|
"github.com/golang/protobuf/v2/internal/fieldnum"
|
||||||
"github.com/golang/protobuf/v2/proto"
|
"github.com/golang/protobuf/v2/proto"
|
||||||
"github.com/golang/protobuf/v2/protogen"
|
"github.com/golang/protobuf/v2/protogen"
|
||||||
"github.com/golang/protobuf/v2/reflect/protoreflect"
|
"github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||||
@ -115,7 +115,7 @@ func GenerateFile(gen *protogen.Plugin, file *protogen.File) *protogen.Generated
|
|||||||
g.P()
|
g.P()
|
||||||
g.PrintLeadingComments(protogen.Location{
|
g.PrintLeadingComments(protogen.Location{
|
||||||
SourceFile: f.Proto.GetName(),
|
SourceFile: f.Proto.GetName(),
|
||||||
Path: []int32{descfield.FileDescriptorProto_Package},
|
Path: []int32{fieldnum.FileDescriptorProto_Package},
|
||||||
})
|
})
|
||||||
g.P()
|
g.P()
|
||||||
g.P("package ", f.GoPackageName)
|
g.P("package ", f.GoPackageName)
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/protobuf/v2/internal/errors"
|
"github.com/golang/protobuf/v2/internal/errors"
|
||||||
|
"github.com/golang/protobuf/v2/internal/fieldnum"
|
||||||
"github.com/golang/protobuf/v2/proto"
|
"github.com/golang/protobuf/v2/proto"
|
||||||
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
|
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
@ -86,15 +87,12 @@ func (e encoder) marshalAny(m pref.Message) error {
|
|||||||
msgType := m.Type()
|
msgType := m.Type()
|
||||||
knownFields := m.KnownFields()
|
knownFields := m.KnownFields()
|
||||||
|
|
||||||
const typeNum = 1 // string type_url.
|
|
||||||
const valueNum = 2 // bytes value.
|
|
||||||
|
|
||||||
// Start writing the JSON object.
|
// Start writing the JSON object.
|
||||||
e.StartObject()
|
e.StartObject()
|
||||||
defer e.EndObject()
|
defer e.EndObject()
|
||||||
|
|
||||||
if !knownFields.Has(typeNum) {
|
if !knownFields.Has(fieldnum.Any_TypeUrl) {
|
||||||
if !knownFields.Has(valueNum) {
|
if !knownFields.Has(fieldnum.Any_Value) {
|
||||||
// If message is empty, marshal out empty JSON object.
|
// If message is empty, marshal out empty JSON object.
|
||||||
return nil
|
return nil
|
||||||
} else {
|
} else {
|
||||||
@ -103,8 +101,8 @@ func (e encoder) marshalAny(m pref.Message) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typeVal := knownFields.Get(typeNum)
|
typeVal := knownFields.Get(fieldnum.Any_TypeUrl)
|
||||||
valueVal := knownFields.Get(valueNum)
|
valueVal := knownFields.Get(fieldnum.Any_Value)
|
||||||
|
|
||||||
// Marshal out @type field.
|
// Marshal out @type field.
|
||||||
typeURL := typeVal.String()
|
typeURL := typeVal.String()
|
||||||
@ -151,7 +149,8 @@ func (e encoder) marshalKnownScalar(m pref.Message) error {
|
|||||||
fieldDescs := msgType.Fields()
|
fieldDescs := msgType.Fields()
|
||||||
knownFields := m.KnownFields()
|
knownFields := m.KnownFields()
|
||||||
|
|
||||||
const num = 1 // Field "value", type is dependent on msgType.
|
// The "value" field has the same field number for all wrapper types.
|
||||||
|
const num = fieldnum.BoolValue_Value
|
||||||
fd := fieldDescs.ByNumber(num)
|
fd := fieldDescs.ByNumber(num)
|
||||||
val := knownFields.Get(num)
|
val := knownFields.Get(num)
|
||||||
return e.marshalSingular(val, fd)
|
return e.marshalSingular(val, fd)
|
||||||
@ -162,9 +161,8 @@ func (e encoder) marshalStruct(m pref.Message) error {
|
|||||||
fieldDescs := msgType.Fields()
|
fieldDescs := msgType.Fields()
|
||||||
knownFields := m.KnownFields()
|
knownFields := m.KnownFields()
|
||||||
|
|
||||||
const num = 1 // map<string, Value> fields.
|
fd := fieldDescs.ByNumber(fieldnum.Struct_Fields)
|
||||||
fd := fieldDescs.ByNumber(num)
|
val := knownFields.Get(fieldnum.Struct_Fields)
|
||||||
val := knownFields.Get(num)
|
|
||||||
return e.marshalMap(val.Map(), fd)
|
return e.marshalMap(val.Map(), fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,9 +171,8 @@ func (e encoder) marshalListValue(m pref.Message) error {
|
|||||||
fieldDescs := msgType.Fields()
|
fieldDescs := msgType.Fields()
|
||||||
knownFields := m.KnownFields()
|
knownFields := m.KnownFields()
|
||||||
|
|
||||||
const num = 1 // repeated Value values.
|
fd := fieldDescs.ByNumber(fieldnum.ListValue_Values)
|
||||||
fd := fieldDescs.ByNumber(num)
|
val := knownFields.Get(fieldnum.ListValue_Values)
|
||||||
val := knownFields.Get(num)
|
|
||||||
return e.marshalList(val.List(), fd)
|
return e.marshalList(val.List(), fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,11 +213,8 @@ func (e encoder) marshalDuration(m pref.Message) error {
|
|||||||
msgType := m.Type()
|
msgType := m.Type()
|
||||||
knownFields := m.KnownFields()
|
knownFields := m.KnownFields()
|
||||||
|
|
||||||
const secsNum = 1 // int64 seconds.
|
secsVal := knownFields.Get(fieldnum.Duration_Seconds)
|
||||||
const nanosNum = 2 // int32 nanos.
|
nanosVal := knownFields.Get(fieldnum.Duration_Nanos)
|
||||||
|
|
||||||
secsVal := knownFields.Get(secsNum)
|
|
||||||
nanosVal := knownFields.Get(nanosNum)
|
|
||||||
secs := secsVal.Int()
|
secs := secsVal.Int()
|
||||||
nanos := nanosVal.Int()
|
nanos := nanosVal.Int()
|
||||||
if secs < -maxSecondsInDuration || secs > maxSecondsInDuration {
|
if secs < -maxSecondsInDuration || secs > maxSecondsInDuration {
|
||||||
@ -258,11 +252,8 @@ func (e encoder) marshalTimestamp(m pref.Message) error {
|
|||||||
msgType := m.Type()
|
msgType := m.Type()
|
||||||
knownFields := m.KnownFields()
|
knownFields := m.KnownFields()
|
||||||
|
|
||||||
const secsNum = 1 // int64 seconds.
|
secsVal := knownFields.Get(fieldnum.Timestamp_Seconds)
|
||||||
const nanosNum = 2 // int32 nanos.
|
nanosVal := knownFields.Get(fieldnum.Timestamp_Nanos)
|
||||||
|
|
||||||
secsVal := knownFields.Get(secsNum)
|
|
||||||
nanosVal := knownFields.Get(nanosNum)
|
|
||||||
secs := secsVal.Int()
|
secs := secsVal.Int()
|
||||||
nanos := nanosVal.Int()
|
nanos := nanosVal.Int()
|
||||||
if secs < minTimestampSeconds || secs > maxTimestampSeconds {
|
if secs < minTimestampSeconds || secs > maxTimestampSeconds {
|
||||||
@ -287,8 +278,7 @@ func (e encoder) marshalFieldMask(m pref.Message) error {
|
|||||||
knownFields := m.KnownFields()
|
knownFields := m.KnownFields()
|
||||||
name := msgType.FullName()
|
name := msgType.FullName()
|
||||||
|
|
||||||
const num = 1 // repeated string paths.
|
val := knownFields.Get(fieldnum.FieldMask_Paths)
|
||||||
val := knownFields.Get(num)
|
|
||||||
list := val.List()
|
list := val.List()
|
||||||
paths := make([]string, 0, list.Len())
|
paths := make([]string, 0, list.Len())
|
||||||
|
|
||||||
|
@ -27,6 +27,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
// Determine repository root path.
|
||||||
|
out, err := exec.Command("git", "rev-parse", "--show-toplevel").CombinedOutput()
|
||||||
|
check(err)
|
||||||
|
repoRoot = strings.TrimSpace(string(out))
|
||||||
|
|
||||||
|
// Determine the module path.
|
||||||
|
cmd := exec.Command("go", "list", "-m", "-f", "{{.Path}}")
|
||||||
|
cmd.Dir = repoRoot
|
||||||
|
out, err = cmd.CombinedOutput()
|
||||||
|
check(err)
|
||||||
|
modulePath = strings.TrimSpace(string(out))
|
||||||
|
|
||||||
// When the environment variable RUN_AS_PROTOC_PLUGIN is set,
|
// When the environment variable RUN_AS_PROTOC_PLUGIN is set,
|
||||||
// we skip running main and instead act as a protoc plugin.
|
// we skip running main and instead act as a protoc plugin.
|
||||||
// This allows the binary to pass itself to protoc.
|
// This allows the binary to pass itself to protoc.
|
||||||
@ -42,7 +54,7 @@ func init() {
|
|||||||
switch plugin {
|
switch plugin {
|
||||||
case "go":
|
case "go":
|
||||||
gengo.GenerateFile(gen, file)
|
gengo.GenerateFile(gen, file)
|
||||||
generateDescriptorFields(gen, file)
|
generateFieldNumbers(gen, file)
|
||||||
case "gogrpc":
|
case "gogrpc":
|
||||||
gengogrpc.GenerateFile(gen, file)
|
gengogrpc.GenerateFile(gen, file)
|
||||||
}
|
}
|
||||||
@ -79,18 +91,6 @@ func main() {
|
|||||||
panic("protobuf source root is not set")
|
panic("protobuf source root is not set")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine repository root path.
|
|
||||||
out, err := exec.Command("git", "rev-parse", "--show-toplevel").CombinedOutput()
|
|
||||||
check(err)
|
|
||||||
repoRoot = strings.TrimSpace(string(out))
|
|
||||||
|
|
||||||
// Determine the module path.
|
|
||||||
cmd := exec.Command("go", "list", "-m", "-f", "{{.Path}}")
|
|
||||||
cmd.Dir = repoRoot
|
|
||||||
out, err = cmd.CombinedOutput()
|
|
||||||
check(err)
|
|
||||||
modulePath = strings.TrimSpace(string(out))
|
|
||||||
|
|
||||||
generateLocalProtos()
|
generateLocalProtos()
|
||||||
generateRemoteProtos()
|
generateRemoteProtos()
|
||||||
}
|
}
|
||||||
@ -208,18 +208,19 @@ func protoc(plugins string, args ...string) {
|
|||||||
check(err)
|
check(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// generateDescriptorFields generates an internal package for descriptor.proto.
|
// generateFieldNumbers generates an internal package for descriptor.proto
|
||||||
func generateDescriptorFields(gen *protogen.Plugin, file *protogen.File) {
|
// and well-known types.
|
||||||
if file.Desc.Path() != "google/protobuf/descriptor.proto" {
|
func generateFieldNumbers(gen *protogen.Plugin, file *protogen.File) {
|
||||||
|
if file.Desc.Package() != "google.protobuf" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
importPath := modulePath + "/internal/descfield"
|
importPath := modulePath + "/internal/fieldnum"
|
||||||
g := gen.NewGeneratedFile(importPath+"/field_gen.go", protogen.GoImportPath(importPath))
|
base := strings.TrimSuffix(path.Base(file.Desc.Path()), ".proto")
|
||||||
|
g := gen.NewGeneratedFile(importPath+"/"+base+"_gen.go", protogen.GoImportPath(importPath))
|
||||||
for _, s := range generatedPreamble {
|
for _, s := range generatedPreamble {
|
||||||
g.P(s)
|
g.P(s)
|
||||||
}
|
}
|
||||||
g.P("// Package descfield contains constants for field numbers in descriptor.proto.")
|
|
||||||
g.P("package ", path.Base(importPath))
|
g.P("package ", path.Base(importPath))
|
||||||
g.P("")
|
g.P("")
|
||||||
|
|
||||||
|
13
internal/fieldnum/any_gen.go
Normal file
13
internal/fieldnum/any_gen.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style.
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Code generated by generate-protos. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fieldnum
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Any.
|
||||||
|
const (
|
||||||
|
Any_TypeUrl = 1 // optional string
|
||||||
|
Any_Value = 2 // optional bytes
|
||||||
|
)
|
35
internal/fieldnum/api_gen.go
Normal file
35
internal/fieldnum/api_gen.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style.
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Code generated by generate-protos. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fieldnum
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Api.
|
||||||
|
const (
|
||||||
|
Api_Name = 1 // optional string
|
||||||
|
Api_Methods = 2 // repeated google.protobuf.Method
|
||||||
|
Api_Options = 3 // repeated google.protobuf.Option
|
||||||
|
Api_Version = 4 // optional string
|
||||||
|
Api_SourceContext = 5 // optional google.protobuf.SourceContext
|
||||||
|
Api_Mixins = 6 // repeated google.protobuf.Mixin
|
||||||
|
Api_Syntax = 7 // optional google.protobuf.Syntax
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Method.
|
||||||
|
const (
|
||||||
|
Method_Name = 1 // optional string
|
||||||
|
Method_RequestTypeUrl = 2 // optional string
|
||||||
|
Method_RequestStreaming = 3 // optional bool
|
||||||
|
Method_ResponseTypeUrl = 4 // optional string
|
||||||
|
Method_ResponseStreaming = 5 // optional bool
|
||||||
|
Method_Options = 6 // repeated google.protobuf.Option
|
||||||
|
Method_Syntax = 7 // optional google.protobuf.Syntax
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Mixin.
|
||||||
|
const (
|
||||||
|
Mixin_Name = 1 // optional string
|
||||||
|
Mixin_Root = 2 // optional string
|
||||||
|
)
|
@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
// Code generated by generate-protos. DO NOT EDIT.
|
// Code generated by generate-protos. DO NOT EDIT.
|
||||||
|
|
||||||
// Package descfield contains constants for field numbers in descriptor.proto.
|
package fieldnum
|
||||||
package descfield
|
|
||||||
|
|
||||||
// Field numbers for google.protobuf.FileDescriptorSet.
|
// Field numbers for google.protobuf.FileDescriptorSet.
|
||||||
const (
|
const (
|
7
internal/fieldnum/doc.go
Normal file
7
internal/fieldnum/doc.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Package fieldnum contains constants for field numbers of fields in messages
|
||||||
|
// declared in descriptor.proto and any of the well-known types.
|
||||||
|
package fieldnum
|
13
internal/fieldnum/duration_gen.go
Normal file
13
internal/fieldnum/duration_gen.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style.
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Code generated by generate-protos. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fieldnum
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Duration.
|
||||||
|
const (
|
||||||
|
Duration_Seconds = 1 // optional int64
|
||||||
|
Duration_Nanos = 2 // optional int32
|
||||||
|
)
|
10
internal/fieldnum/empty_gen.go
Normal file
10
internal/fieldnum/empty_gen.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style.
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Code generated by generate-protos. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fieldnum
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Empty.
|
||||||
|
const ()
|
12
internal/fieldnum/field_mask_gen.go
Normal file
12
internal/fieldnum/field_mask_gen.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style.
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Code generated by generate-protos. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fieldnum
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.FieldMask.
|
||||||
|
const (
|
||||||
|
FieldMask_Paths = 1 // repeated string
|
||||||
|
)
|
12
internal/fieldnum/source_context_gen.go
Normal file
12
internal/fieldnum/source_context_gen.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style.
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Code generated by generate-protos. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fieldnum
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.SourceContext.
|
||||||
|
const (
|
||||||
|
SourceContext_FileName = 1 // optional string
|
||||||
|
)
|
33
internal/fieldnum/struct_gen.go
Normal file
33
internal/fieldnum/struct_gen.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style.
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Code generated by generate-protos. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fieldnum
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Struct.
|
||||||
|
const (
|
||||||
|
Struct_Fields = 1 // repeated google.protobuf.Struct.FieldsEntry
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Struct.FieldsEntry.
|
||||||
|
const (
|
||||||
|
Struct_FieldsEntry_Key = 1 // optional string
|
||||||
|
Struct_FieldsEntry_Value = 2 // optional google.protobuf.Value
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Value.
|
||||||
|
const (
|
||||||
|
Value_NullValue = 1 // optional google.protobuf.NullValue
|
||||||
|
Value_NumberValue = 2 // optional double
|
||||||
|
Value_StringValue = 3 // optional string
|
||||||
|
Value_BoolValue = 4 // optional bool
|
||||||
|
Value_StructValue = 5 // optional google.protobuf.Struct
|
||||||
|
Value_ListValue = 6 // optional google.protobuf.ListValue
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.ListValue.
|
||||||
|
const (
|
||||||
|
ListValue_Values = 1 // repeated google.protobuf.Value
|
||||||
|
)
|
13
internal/fieldnum/timestamp_gen.go
Normal file
13
internal/fieldnum/timestamp_gen.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style.
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Code generated by generate-protos. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fieldnum
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Timestamp.
|
||||||
|
const (
|
||||||
|
Timestamp_Seconds = 1 // optional int64
|
||||||
|
Timestamp_Nanos = 2 // optional int32
|
||||||
|
)
|
53
internal/fieldnum/type_gen.go
Normal file
53
internal/fieldnum/type_gen.go
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style.
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Code generated by generate-protos. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fieldnum
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Type.
|
||||||
|
const (
|
||||||
|
Type_Name = 1 // optional string
|
||||||
|
Type_Fields = 2 // repeated google.protobuf.Field
|
||||||
|
Type_Oneofs = 3 // repeated string
|
||||||
|
Type_Options = 4 // repeated google.protobuf.Option
|
||||||
|
Type_SourceContext = 5 // optional google.protobuf.SourceContext
|
||||||
|
Type_Syntax = 6 // optional google.protobuf.Syntax
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Field.
|
||||||
|
const (
|
||||||
|
Field_Kind = 1 // optional google.protobuf.Field.Kind
|
||||||
|
Field_Cardinality = 2 // optional google.protobuf.Field.Cardinality
|
||||||
|
Field_Number = 3 // optional int32
|
||||||
|
Field_Name = 4 // optional string
|
||||||
|
Field_TypeUrl = 6 // optional string
|
||||||
|
Field_OneofIndex = 7 // optional int32
|
||||||
|
Field_Packed = 8 // optional bool
|
||||||
|
Field_Options = 9 // repeated google.protobuf.Option
|
||||||
|
Field_JsonName = 10 // optional string
|
||||||
|
Field_DefaultValue = 11 // optional string
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Enum.
|
||||||
|
const (
|
||||||
|
Enum_Name = 1 // optional string
|
||||||
|
Enum_Enumvalue = 2 // repeated google.protobuf.EnumValue
|
||||||
|
Enum_Options = 3 // repeated google.protobuf.Option
|
||||||
|
Enum_SourceContext = 4 // optional google.protobuf.SourceContext
|
||||||
|
Enum_Syntax = 5 // optional google.protobuf.Syntax
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.EnumValue.
|
||||||
|
const (
|
||||||
|
EnumValue_Name = 1 // optional string
|
||||||
|
EnumValue_Number = 2 // optional int32
|
||||||
|
EnumValue_Options = 3 // repeated google.protobuf.Option
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Option.
|
||||||
|
const (
|
||||||
|
Option_Name = 1 // optional string
|
||||||
|
Option_Value = 2 // optional google.protobuf.Any
|
||||||
|
)
|
52
internal/fieldnum/wrappers_gen.go
Normal file
52
internal/fieldnum/wrappers_gen.go
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style.
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Code generated by generate-protos. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fieldnum
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.DoubleValue.
|
||||||
|
const (
|
||||||
|
DoubleValue_Value = 1 // optional double
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.FloatValue.
|
||||||
|
const (
|
||||||
|
FloatValue_Value = 1 // optional float
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Int64Value.
|
||||||
|
const (
|
||||||
|
Int64Value_Value = 1 // optional int64
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.UInt64Value.
|
||||||
|
const (
|
||||||
|
UInt64Value_Value = 1 // optional uint64
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.Int32Value.
|
||||||
|
const (
|
||||||
|
Int32Value_Value = 1 // optional int32
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.UInt32Value.
|
||||||
|
const (
|
||||||
|
UInt32Value_Value = 1 // optional uint32
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.BoolValue.
|
||||||
|
const (
|
||||||
|
BoolValue_Value = 1 // optional bool
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.StringValue.
|
||||||
|
const (
|
||||||
|
StringValue_Value = 1 // optional string
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.BytesValue.
|
||||||
|
const (
|
||||||
|
BytesValue_Value = 1 // optional bytes
|
||||||
|
)
|
@ -5,8 +5,8 @@
|
|||||||
package fileinit
|
package fileinit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
descfield "github.com/golang/protobuf/v2/internal/descfield"
|
|
||||||
wire "github.com/golang/protobuf/v2/internal/encoding/wire"
|
wire "github.com/golang/protobuf/v2/internal/encoding/wire"
|
||||||
|
fieldnum "github.com/golang/protobuf/v2/internal/fieldnum"
|
||||||
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
|
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -89,36 +89,36 @@ func (fd *fileDesc) unmarshalSeed(b []byte) {
|
|||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.FileDescriptorProto_Name:
|
case fieldnum.FileDescriptorProto_Name:
|
||||||
fd.path = nb.MakeString(v)
|
fd.path = nb.MakeString(v)
|
||||||
case descfield.FileDescriptorProto_Package:
|
case fieldnum.FileDescriptorProto_Package:
|
||||||
fd.protoPackage = pref.FullName(nb.MakeString(v))
|
fd.protoPackage = pref.FullName(nb.MakeString(v))
|
||||||
case descfield.FileDescriptorProto_EnumType:
|
case fieldnum.FileDescriptorProto_EnumType:
|
||||||
if prevField != descfield.FileDescriptorProto_EnumType {
|
if prevField != fieldnum.FileDescriptorProto_EnumType {
|
||||||
if numEnums > 0 {
|
if numEnums > 0 {
|
||||||
panic("non-contiguous repeated field")
|
panic("non-contiguous repeated field")
|
||||||
}
|
}
|
||||||
posEnums = len(b0) - len(b) - n - m
|
posEnums = len(b0) - len(b) - n - m
|
||||||
}
|
}
|
||||||
numEnums++
|
numEnums++
|
||||||
case descfield.FileDescriptorProto_MessageType:
|
case fieldnum.FileDescriptorProto_MessageType:
|
||||||
if prevField != descfield.FileDescriptorProto_MessageType {
|
if prevField != fieldnum.FileDescriptorProto_MessageType {
|
||||||
if numMessages > 0 {
|
if numMessages > 0 {
|
||||||
panic("non-contiguous repeated field")
|
panic("non-contiguous repeated field")
|
||||||
}
|
}
|
||||||
posMessages = len(b0) - len(b) - n - m
|
posMessages = len(b0) - len(b) - n - m
|
||||||
}
|
}
|
||||||
numMessages++
|
numMessages++
|
||||||
case descfield.FileDescriptorProto_Extension:
|
case fieldnum.FileDescriptorProto_Extension:
|
||||||
if prevField != descfield.FileDescriptorProto_Extension {
|
if prevField != fieldnum.FileDescriptorProto_Extension {
|
||||||
if numExtensions > 0 {
|
if numExtensions > 0 {
|
||||||
panic("non-contiguous repeated field")
|
panic("non-contiguous repeated field")
|
||||||
}
|
}
|
||||||
posExtensions = len(b0) - len(b) - n - m
|
posExtensions = len(b0) - len(b) - n - m
|
||||||
}
|
}
|
||||||
numExtensions++
|
numExtensions++
|
||||||
case descfield.FileDescriptorProto_Service:
|
case fieldnum.FileDescriptorProto_Service:
|
||||||
if prevField != descfield.FileDescriptorProto_Service {
|
if prevField != fieldnum.FileDescriptorProto_Service {
|
||||||
if numServices > 0 {
|
if numServices > 0 {
|
||||||
panic("non-contiguous repeated field")
|
panic("non-contiguous repeated field")
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ func (ed *enumDesc) unmarshalSeed(b []byte, nb *nameBuilder, pf *fileDesc, pd pr
|
|||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.EnumDescriptorProto_Name:
|
case fieldnum.EnumDescriptorProto_Name:
|
||||||
ed.fullName = nb.AppendFullName(pd.FullName(), v)
|
ed.fullName = nb.AppendFullName(pd.FullName(), v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -227,26 +227,26 @@ func (md *messageDesc) unmarshalSeed(b []byte, nb *nameBuilder, pf *fileDesc, pd
|
|||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.DescriptorProto_Name:
|
case fieldnum.DescriptorProto_Name:
|
||||||
md.fullName = nb.AppendFullName(pd.FullName(), v)
|
md.fullName = nb.AppendFullName(pd.FullName(), v)
|
||||||
case descfield.DescriptorProto_EnumType:
|
case fieldnum.DescriptorProto_EnumType:
|
||||||
if prevField != descfield.DescriptorProto_EnumType {
|
if prevField != fieldnum.DescriptorProto_EnumType {
|
||||||
if numEnums > 0 {
|
if numEnums > 0 {
|
||||||
panic("non-contiguous repeated field")
|
panic("non-contiguous repeated field")
|
||||||
}
|
}
|
||||||
posEnums = len(b0) - len(b) - n - m
|
posEnums = len(b0) - len(b) - n - m
|
||||||
}
|
}
|
||||||
numEnums++
|
numEnums++
|
||||||
case descfield.DescriptorProto_NestedType:
|
case fieldnum.DescriptorProto_NestedType:
|
||||||
if prevField != descfield.DescriptorProto_NestedType {
|
if prevField != fieldnum.DescriptorProto_NestedType {
|
||||||
if numMessages > 0 {
|
if numMessages > 0 {
|
||||||
panic("non-contiguous repeated field")
|
panic("non-contiguous repeated field")
|
||||||
}
|
}
|
||||||
posMessages = len(b0) - len(b) - n - m
|
posMessages = len(b0) - len(b) - n - m
|
||||||
}
|
}
|
||||||
numMessages++
|
numMessages++
|
||||||
case descfield.DescriptorProto_Extension:
|
case fieldnum.DescriptorProto_Extension:
|
||||||
if prevField != descfield.DescriptorProto_Extension {
|
if prevField != fieldnum.DescriptorProto_Extension {
|
||||||
if numExtensions > 0 {
|
if numExtensions > 0 {
|
||||||
panic("non-contiguous repeated field")
|
panic("non-contiguous repeated field")
|
||||||
}
|
}
|
||||||
@ -316,14 +316,14 @@ func (xd *extensionDesc) unmarshalSeed(b []byte, nb *nameBuilder, pf *fileDesc,
|
|||||||
v, m := wire.ConsumeVarint(b)
|
v, m := wire.ConsumeVarint(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.FieldDescriptorProto_Number:
|
case fieldnum.FieldDescriptorProto_Number:
|
||||||
xd.number = pref.FieldNumber(v)
|
xd.number = pref.FieldNumber(v)
|
||||||
}
|
}
|
||||||
case wire.BytesType:
|
case wire.BytesType:
|
||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.FieldDescriptorProto_Name:
|
case fieldnum.FieldDescriptorProto_Name:
|
||||||
xd.fullName = nb.AppendFullName(pd.FullName(), v)
|
xd.fullName = nb.AppendFullName(pd.FullName(), v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -346,7 +346,7 @@ func (sd *serviceDesc) unmarshalSeed(b []byte, nb *nameBuilder, pf *fileDesc, pd
|
|||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.ServiceDescriptorProto_Name:
|
case fieldnum.ServiceDescriptorProto_Name:
|
||||||
sd.fullName = nb.AppendFullName(pd.FullName(), v)
|
sd.fullName = nb.AppendFullName(pd.FullName(), v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -9,9 +9,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
descfield "github.com/golang/protobuf/v2/internal/descfield"
|
|
||||||
defval "github.com/golang/protobuf/v2/internal/encoding/defval"
|
defval "github.com/golang/protobuf/v2/internal/encoding/defval"
|
||||||
wire "github.com/golang/protobuf/v2/internal/encoding/wire"
|
wire "github.com/golang/protobuf/v2/internal/encoding/wire"
|
||||||
|
fieldnum "github.com/golang/protobuf/v2/internal/fieldnum"
|
||||||
pimpl "github.com/golang/protobuf/v2/internal/impl"
|
pimpl "github.com/golang/protobuf/v2/internal/impl"
|
||||||
ptype "github.com/golang/protobuf/v2/internal/prototype"
|
ptype "github.com/golang/protobuf/v2/internal/prototype"
|
||||||
pvalue "github.com/golang/protobuf/v2/internal/value"
|
pvalue "github.com/golang/protobuf/v2/internal/value"
|
||||||
@ -345,16 +345,16 @@ func (fd *fileDesc) unmarshalFull(b []byte) {
|
|||||||
v, m := wire.ConsumeVarint(b)
|
v, m := wire.ConsumeVarint(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.FileDescriptorProto_PublicDependency:
|
case fieldnum.FileDescriptorProto_PublicDependency:
|
||||||
fd.lazy.imports[v].IsPublic = true
|
fd.lazy.imports[v].IsPublic = true
|
||||||
case descfield.FileDescriptorProto_WeakDependency:
|
case fieldnum.FileDescriptorProto_WeakDependency:
|
||||||
fd.lazy.imports[v].IsWeak = true
|
fd.lazy.imports[v].IsWeak = true
|
||||||
}
|
}
|
||||||
case wire.BytesType:
|
case wire.BytesType:
|
||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.FileDescriptorProto_Syntax:
|
case fieldnum.FileDescriptorProto_Syntax:
|
||||||
hasSyntax = true
|
hasSyntax = true
|
||||||
switch string(v) {
|
switch string(v) {
|
||||||
case "proto2":
|
case "proto2":
|
||||||
@ -364,23 +364,23 @@ func (fd *fileDesc) unmarshalFull(b []byte) {
|
|||||||
default:
|
default:
|
||||||
panic("invalid syntax")
|
panic("invalid syntax")
|
||||||
}
|
}
|
||||||
case descfield.FileDescriptorProto_Dependency:
|
case fieldnum.FileDescriptorProto_Dependency:
|
||||||
fd.lazy.imports = append(fd.lazy.imports, pref.FileImport{
|
fd.lazy.imports = append(fd.lazy.imports, pref.FileImport{
|
||||||
FileDescriptor: ptype.PlaceholderFile(nb.MakeString(v), ""),
|
FileDescriptor: ptype.PlaceholderFile(nb.MakeString(v), ""),
|
||||||
})
|
})
|
||||||
case descfield.FileDescriptorProto_EnumType:
|
case fieldnum.FileDescriptorProto_EnumType:
|
||||||
fd.enums.list[enumIdx].unmarshalFull(v, nb)
|
fd.enums.list[enumIdx].unmarshalFull(v, nb)
|
||||||
enumIdx++
|
enumIdx++
|
||||||
case descfield.FileDescriptorProto_MessageType:
|
case fieldnum.FileDescriptorProto_MessageType:
|
||||||
fd.messages.list[messageIdx].unmarshalFull(v, nb)
|
fd.messages.list[messageIdx].unmarshalFull(v, nb)
|
||||||
messageIdx++
|
messageIdx++
|
||||||
case descfield.FileDescriptorProto_Extension:
|
case fieldnum.FileDescriptorProto_Extension:
|
||||||
fd.extensions.list[extensionIdx].unmarshalFull(v, nb)
|
fd.extensions.list[extensionIdx].unmarshalFull(v, nb)
|
||||||
extensionIdx++
|
extensionIdx++
|
||||||
case descfield.FileDescriptorProto_Service:
|
case fieldnum.FileDescriptorProto_Service:
|
||||||
fd.services.list[serviceIdx].unmarshalFull(v, nb)
|
fd.services.list[serviceIdx].unmarshalFull(v, nb)
|
||||||
serviceIdx++
|
serviceIdx++
|
||||||
case descfield.FileDescriptorProto_Options:
|
case fieldnum.FileDescriptorProto_Options:
|
||||||
fd.lazy.options = append(fd.lazy.options, v...)
|
fd.lazy.options = append(fd.lazy.options, v...)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -406,13 +406,13 @@ func (ed *enumDesc) unmarshalFull(b []byte, nb *nameBuilder) {
|
|||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.EnumDescriptorProto_Value:
|
case fieldnum.EnumDescriptorProto_Value:
|
||||||
rawValues = append(rawValues, v)
|
rawValues = append(rawValues, v)
|
||||||
case descfield.EnumDescriptorProto_ReservedName:
|
case fieldnum.EnumDescriptorProto_ReservedName:
|
||||||
ed.lazy.resvNames.list = append(ed.lazy.resvNames.list, pref.Name(nb.MakeString(v)))
|
ed.lazy.resvNames.list = append(ed.lazy.resvNames.list, pref.Name(nb.MakeString(v)))
|
||||||
case descfield.EnumDescriptorProto_ReservedRange:
|
case fieldnum.EnumDescriptorProto_ReservedRange:
|
||||||
ed.lazy.resvRanges.list = append(ed.lazy.resvRanges.list, unmarshalEnumReservedRange(v))
|
ed.lazy.resvRanges.list = append(ed.lazy.resvRanges.list, unmarshalEnumReservedRange(v))
|
||||||
case descfield.EnumDescriptorProto_Options:
|
case fieldnum.EnumDescriptorProto_Options:
|
||||||
ed.lazy.options = append(ed.lazy.options, v...)
|
ed.lazy.options = append(ed.lazy.options, v...)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -440,9 +440,9 @@ func unmarshalEnumReservedRange(b []byte) (r [2]pref.EnumNumber) {
|
|||||||
v, m := wire.ConsumeVarint(b)
|
v, m := wire.ConsumeVarint(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.EnumDescriptorProto_EnumReservedRange_Start:
|
case fieldnum.EnumDescriptorProto_EnumReservedRange_Start:
|
||||||
r[0] = pref.EnumNumber(v)
|
r[0] = pref.EnumNumber(v)
|
||||||
case descfield.EnumDescriptorProto_EnumReservedRange_End:
|
case fieldnum.EnumDescriptorProto_EnumReservedRange_End:
|
||||||
r[1] = pref.EnumNumber(v)
|
r[1] = pref.EnumNumber(v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -466,16 +466,16 @@ func (vd *enumValueDesc) unmarshalFull(b []byte, nb *nameBuilder, pf *fileDesc,
|
|||||||
v, m := wire.ConsumeVarint(b)
|
v, m := wire.ConsumeVarint(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.EnumValueDescriptorProto_Number:
|
case fieldnum.EnumValueDescriptorProto_Number:
|
||||||
vd.number = pref.EnumNumber(v)
|
vd.number = pref.EnumNumber(v)
|
||||||
}
|
}
|
||||||
case wire.BytesType:
|
case wire.BytesType:
|
||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.EnumValueDescriptorProto_Name:
|
case fieldnum.EnumValueDescriptorProto_Name:
|
||||||
vd.fullName = nb.AppendFullName(pd.FullName(), v)
|
vd.fullName = nb.AppendFullName(pd.FullName(), v)
|
||||||
case descfield.EnumValueDescriptorProto_Options:
|
case fieldnum.EnumValueDescriptorProto_Options:
|
||||||
vd.options = append(vd.options, v...)
|
vd.options = append(vd.options, v...)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -499,28 +499,28 @@ func (md *messageDesc) unmarshalFull(b []byte, nb *nameBuilder) {
|
|||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.DescriptorProto_Field:
|
case fieldnum.DescriptorProto_Field:
|
||||||
rawFields = append(rawFields, v)
|
rawFields = append(rawFields, v)
|
||||||
case descfield.DescriptorProto_OneofDecl:
|
case fieldnum.DescriptorProto_OneofDecl:
|
||||||
rawOneofs = append(rawOneofs, v)
|
rawOneofs = append(rawOneofs, v)
|
||||||
case descfield.DescriptorProto_ReservedName:
|
case fieldnum.DescriptorProto_ReservedName:
|
||||||
md.lazy.resvNames.list = append(md.lazy.resvNames.list, pref.Name(nb.MakeString(v)))
|
md.lazy.resvNames.list = append(md.lazy.resvNames.list, pref.Name(nb.MakeString(v)))
|
||||||
case descfield.DescriptorProto_ReservedRange:
|
case fieldnum.DescriptorProto_ReservedRange:
|
||||||
md.lazy.resvRanges.list = append(md.lazy.resvRanges.list, unmarshalMessageReservedRange(v))
|
md.lazy.resvRanges.list = append(md.lazy.resvRanges.list, unmarshalMessageReservedRange(v))
|
||||||
case descfield.DescriptorProto_ExtensionRange:
|
case fieldnum.DescriptorProto_ExtensionRange:
|
||||||
r, opts := unmarshalMessageExtensionRange(v)
|
r, opts := unmarshalMessageExtensionRange(v)
|
||||||
md.lazy.extRanges.list = append(md.lazy.extRanges.list, r)
|
md.lazy.extRanges.list = append(md.lazy.extRanges.list, r)
|
||||||
md.lazy.extRangeOptions = append(md.lazy.extRangeOptions, opts)
|
md.lazy.extRangeOptions = append(md.lazy.extRangeOptions, opts)
|
||||||
case descfield.DescriptorProto_EnumType:
|
case fieldnum.DescriptorProto_EnumType:
|
||||||
md.enums.list[enumIdx].unmarshalFull(v, nb)
|
md.enums.list[enumIdx].unmarshalFull(v, nb)
|
||||||
enumIdx++
|
enumIdx++
|
||||||
case descfield.DescriptorProto_NestedType:
|
case fieldnum.DescriptorProto_NestedType:
|
||||||
md.messages.list[messageIdx].unmarshalFull(v, nb)
|
md.messages.list[messageIdx].unmarshalFull(v, nb)
|
||||||
messageIdx++
|
messageIdx++
|
||||||
case descfield.DescriptorProto_Extension:
|
case fieldnum.DescriptorProto_Extension:
|
||||||
md.extensions.list[extensionIdx].unmarshalFull(v, nb)
|
md.extensions.list[extensionIdx].unmarshalFull(v, nb)
|
||||||
extensionIdx++
|
extensionIdx++
|
||||||
case descfield.DescriptorProto_Options:
|
case fieldnum.DescriptorProto_Options:
|
||||||
md.unmarshalOptions(v)
|
md.unmarshalOptions(v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -558,9 +558,9 @@ func (md *messageDesc) unmarshalOptions(b []byte) {
|
|||||||
v, m := wire.ConsumeVarint(b)
|
v, m := wire.ConsumeVarint(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.MessageOptions_MapEntry:
|
case fieldnum.MessageOptions_MapEntry:
|
||||||
md.lazy.isMapEntry = wire.DecodeBool(v)
|
md.lazy.isMapEntry = wire.DecodeBool(v)
|
||||||
case descfield.MessageOptions_MessageSetWireFormat:
|
case fieldnum.MessageOptions_MessageSetWireFormat:
|
||||||
md.lazy.isMessageSet = wire.DecodeBool(v)
|
md.lazy.isMessageSet = wire.DecodeBool(v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -579,9 +579,9 @@ func unmarshalMessageReservedRange(b []byte) (r [2]pref.FieldNumber) {
|
|||||||
v, m := wire.ConsumeVarint(b)
|
v, m := wire.ConsumeVarint(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.DescriptorProto_ReservedRange_Start:
|
case fieldnum.DescriptorProto_ReservedRange_Start:
|
||||||
r[0] = pref.FieldNumber(v)
|
r[0] = pref.FieldNumber(v)
|
||||||
case descfield.DescriptorProto_ReservedRange_End:
|
case fieldnum.DescriptorProto_ReservedRange_End:
|
||||||
r[1] = pref.FieldNumber(v)
|
r[1] = pref.FieldNumber(v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -601,16 +601,16 @@ func unmarshalMessageExtensionRange(b []byte) (r [2]pref.FieldNumber, opts []byt
|
|||||||
v, m := wire.ConsumeVarint(b)
|
v, m := wire.ConsumeVarint(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.DescriptorProto_ExtensionRange_Start:
|
case fieldnum.DescriptorProto_ExtensionRange_Start:
|
||||||
r[0] = pref.FieldNumber(v)
|
r[0] = pref.FieldNumber(v)
|
||||||
case descfield.DescriptorProto_ExtensionRange_End:
|
case fieldnum.DescriptorProto_ExtensionRange_End:
|
||||||
r[1] = pref.FieldNumber(v)
|
r[1] = pref.FieldNumber(v)
|
||||||
}
|
}
|
||||||
case wire.BytesType:
|
case wire.BytesType:
|
||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.DescriptorProto_ExtensionRange_Options:
|
case fieldnum.DescriptorProto_ExtensionRange_Options:
|
||||||
opts = append(opts, v...)
|
opts = append(opts, v...)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -636,13 +636,13 @@ func (fd *fieldDesc) unmarshalFull(b []byte, nb *nameBuilder, pf *fileDesc, pd p
|
|||||||
v, m := wire.ConsumeVarint(b)
|
v, m := wire.ConsumeVarint(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.FieldDescriptorProto_Number:
|
case fieldnum.FieldDescriptorProto_Number:
|
||||||
fd.number = pref.FieldNumber(v)
|
fd.number = pref.FieldNumber(v)
|
||||||
case descfield.FieldDescriptorProto_Label:
|
case fieldnum.FieldDescriptorProto_Label:
|
||||||
fd.cardinality = pref.Cardinality(v)
|
fd.cardinality = pref.Cardinality(v)
|
||||||
case descfield.FieldDescriptorProto_Type:
|
case fieldnum.FieldDescriptorProto_Type:
|
||||||
fd.kind = pref.Kind(v)
|
fd.kind = pref.Kind(v)
|
||||||
case descfield.FieldDescriptorProto_OneofIndex:
|
case fieldnum.FieldDescriptorProto_OneofIndex:
|
||||||
// In messageDesc.UnmarshalFull, we allocate slices for both
|
// In messageDesc.UnmarshalFull, we allocate slices for both
|
||||||
// the field and oneof descriptors before unmarshaling either
|
// the field and oneof descriptors before unmarshaling either
|
||||||
// of them. This ensures pointers to slice elements are stable.
|
// of them. This ensures pointers to slice elements are stable.
|
||||||
@ -657,17 +657,17 @@ func (fd *fieldDesc) unmarshalFull(b []byte, nb *nameBuilder, pf *fileDesc, pd p
|
|||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.FieldDescriptorProto_Name:
|
case fieldnum.FieldDescriptorProto_Name:
|
||||||
fd.fullName = nb.AppendFullName(pd.FullName(), v)
|
fd.fullName = nb.AppendFullName(pd.FullName(), v)
|
||||||
case descfield.FieldDescriptorProto_JsonName:
|
case fieldnum.FieldDescriptorProto_JsonName:
|
||||||
fd.hasJSONName = true
|
fd.hasJSONName = true
|
||||||
fd.jsonName = nb.MakeString(v)
|
fd.jsonName = nb.MakeString(v)
|
||||||
case descfield.FieldDescriptorProto_DefaultValue:
|
case fieldnum.FieldDescriptorProto_DefaultValue:
|
||||||
fd.defVal.has = true
|
fd.defVal.has = true
|
||||||
rawDefVal = v
|
rawDefVal = v
|
||||||
case descfield.FieldDescriptorProto_TypeName:
|
case fieldnum.FieldDescriptorProto_TypeName:
|
||||||
rawTypeName = v
|
rawTypeName = v
|
||||||
case descfield.FieldDescriptorProto_Options:
|
case fieldnum.FieldDescriptorProto_Options:
|
||||||
fd.unmarshalOptions(v)
|
fd.unmarshalOptions(v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -706,10 +706,10 @@ func (fd *fieldDesc) unmarshalOptions(b []byte) {
|
|||||||
v, m := wire.ConsumeVarint(b)
|
v, m := wire.ConsumeVarint(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.FieldOptions_Packed:
|
case fieldnum.FieldOptions_Packed:
|
||||||
fd.hasPacked = true
|
fd.hasPacked = true
|
||||||
fd.isPacked = wire.DecodeBool(v)
|
fd.isPacked = wire.DecodeBool(v)
|
||||||
case descfield.FieldOptions_Weak:
|
case fieldnum.FieldOptions_Weak:
|
||||||
fd.isWeak = wire.DecodeBool(v)
|
fd.isWeak = wire.DecodeBool(v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -732,9 +732,9 @@ func (od *oneofDesc) unmarshalFull(b []byte, nb *nameBuilder, pf *fileDesc, pd p
|
|||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.OneofDescriptorProto_Name:
|
case fieldnum.OneofDescriptorProto_Name:
|
||||||
od.fullName = nb.AppendFullName(pd.FullName(), v)
|
od.fullName = nb.AppendFullName(pd.FullName(), v)
|
||||||
case descfield.OneofDescriptorProto_Options:
|
case fieldnum.OneofDescriptorProto_Options:
|
||||||
od.options = append(od.options, v...)
|
od.options = append(od.options, v...)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -757,22 +757,22 @@ func (xd *extensionDesc) unmarshalFull(b []byte, nb *nameBuilder) {
|
|||||||
v, m := wire.ConsumeVarint(b)
|
v, m := wire.ConsumeVarint(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.FieldDescriptorProto_Label:
|
case fieldnum.FieldDescriptorProto_Label:
|
||||||
xd.lazy.cardinality = pref.Cardinality(v)
|
xd.lazy.cardinality = pref.Cardinality(v)
|
||||||
case descfield.FieldDescriptorProto_Type:
|
case fieldnum.FieldDescriptorProto_Type:
|
||||||
xd.lazy.kind = pref.Kind(v)
|
xd.lazy.kind = pref.Kind(v)
|
||||||
}
|
}
|
||||||
case wire.BytesType:
|
case wire.BytesType:
|
||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.FieldDescriptorProto_JsonName:
|
case fieldnum.FieldDescriptorProto_JsonName:
|
||||||
xd.lazy.hasJSONName = true
|
xd.lazy.hasJSONName = true
|
||||||
xd.lazy.jsonName = nb.MakeString(v)
|
xd.lazy.jsonName = nb.MakeString(v)
|
||||||
case descfield.FieldDescriptorProto_DefaultValue:
|
case fieldnum.FieldDescriptorProto_DefaultValue:
|
||||||
xd.lazy.defVal.has = true
|
xd.lazy.defVal.has = true
|
||||||
rawDefVal = v
|
rawDefVal = v
|
||||||
case descfield.FieldDescriptorProto_Options:
|
case fieldnum.FieldDescriptorProto_Options:
|
||||||
xd.unmarshalOptions(v)
|
xd.unmarshalOptions(v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -802,7 +802,7 @@ func (xd *extensionDesc) unmarshalOptions(b []byte) {
|
|||||||
v, m := wire.ConsumeVarint(b)
|
v, m := wire.ConsumeVarint(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.FieldOptions_Packed:
|
case fieldnum.FieldOptions_Packed:
|
||||||
xd.lazy.isPacked = wire.DecodeBool(v)
|
xd.lazy.isPacked = wire.DecodeBool(v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -823,9 +823,9 @@ func (sd *serviceDesc) unmarshalFull(b []byte, nb *nameBuilder) {
|
|||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.ServiceDescriptorProto_Method:
|
case fieldnum.ServiceDescriptorProto_Method:
|
||||||
rawMethods = append(rawMethods, v)
|
rawMethods = append(rawMethods, v)
|
||||||
case descfield.ServiceDescriptorProto_Options:
|
case fieldnum.ServiceDescriptorProto_Options:
|
||||||
sd.lazy.options = append(sd.lazy.options, v...)
|
sd.lazy.options = append(sd.lazy.options, v...)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -857,18 +857,18 @@ func (md *methodDesc) unmarshalFull(b []byte, nb *nameBuilder, pf *fileDesc, pd
|
|||||||
v, m := wire.ConsumeVarint(b)
|
v, m := wire.ConsumeVarint(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.MethodDescriptorProto_ClientStreaming:
|
case fieldnum.MethodDescriptorProto_ClientStreaming:
|
||||||
md.isStreamingClient = wire.DecodeBool(v)
|
md.isStreamingClient = wire.DecodeBool(v)
|
||||||
case descfield.MethodDescriptorProto_ServerStreaming:
|
case fieldnum.MethodDescriptorProto_ServerStreaming:
|
||||||
md.isStreamingServer = wire.DecodeBool(v)
|
md.isStreamingServer = wire.DecodeBool(v)
|
||||||
}
|
}
|
||||||
case wire.BytesType:
|
case wire.BytesType:
|
||||||
v, m := wire.ConsumeBytes(b)
|
v, m := wire.ConsumeBytes(b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case descfield.MethodDescriptorProto_Name:
|
case fieldnum.MethodDescriptorProto_Name:
|
||||||
md.fullName = nb.AppendFullName(pd.FullName(), v)
|
md.fullName = nb.AppendFullName(pd.FullName(), v)
|
||||||
case descfield.MethodDescriptorProto_Options:
|
case fieldnum.MethodDescriptorProto_Options:
|
||||||
md.options = append(md.options, v...)
|
md.options = append(md.options, v...)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/protobuf/v2/encoding/textpb"
|
"github.com/golang/protobuf/v2/encoding/textpb"
|
||||||
"github.com/golang/protobuf/v2/internal/descfield"
|
"github.com/golang/protobuf/v2/internal/fieldnum"
|
||||||
"github.com/golang/protobuf/v2/internal/scalar"
|
"github.com/golang/protobuf/v2/internal/scalar"
|
||||||
"github.com/golang/protobuf/v2/proto"
|
"github.com/golang/protobuf/v2/proto"
|
||||||
"github.com/golang/protobuf/v2/reflect/protodesc"
|
"github.com/golang/protobuf/v2/reflect/protodesc"
|
||||||
@ -520,9 +520,9 @@ type Message struct {
|
|||||||
func newMessage(gen *Plugin, f *File, parent *Message, desc protoreflect.MessageDescriptor) *Message {
|
func newMessage(gen *Plugin, f *File, parent *Message, desc protoreflect.MessageDescriptor) *Message {
|
||||||
var loc Location
|
var loc Location
|
||||||
if parent != nil {
|
if parent != nil {
|
||||||
loc = parent.Location.appendPath(descfield.DescriptorProto_NestedType, int32(desc.Index()))
|
loc = parent.Location.appendPath(fieldnum.DescriptorProto_NestedType, int32(desc.Index()))
|
||||||
} else {
|
} else {
|
||||||
loc = f.location(descfield.FileDescriptorProto_MessageType, int32(desc.Index()))
|
loc = f.location(fieldnum.FileDescriptorProto_MessageType, int32(desc.Index()))
|
||||||
}
|
}
|
||||||
message := &Message{
|
message := &Message{
|
||||||
Desc: desc,
|
Desc: desc,
|
||||||
@ -638,11 +638,11 @@ func newField(gen *Plugin, f *File, message *Message, desc protoreflect.FieldDes
|
|||||||
var loc Location
|
var loc Location
|
||||||
switch {
|
switch {
|
||||||
case desc.ExtendedType() != nil && message == nil:
|
case desc.ExtendedType() != nil && message == nil:
|
||||||
loc = f.location(descfield.FileDescriptorProto_Extension, int32(desc.Index()))
|
loc = f.location(fieldnum.FileDescriptorProto_Extension, int32(desc.Index()))
|
||||||
case desc.ExtendedType() != nil && message != nil:
|
case desc.ExtendedType() != nil && message != nil:
|
||||||
loc = message.Location.appendPath(descfield.DescriptorProto_Extension, int32(desc.Index()))
|
loc = message.Location.appendPath(fieldnum.DescriptorProto_Extension, int32(desc.Index()))
|
||||||
default:
|
default:
|
||||||
loc = message.Location.appendPath(descfield.DescriptorProto_Field, int32(desc.Index()))
|
loc = message.Location.appendPath(fieldnum.DescriptorProto_Field, int32(desc.Index()))
|
||||||
}
|
}
|
||||||
field := &Field{
|
field := &Field{
|
||||||
Desc: desc,
|
Desc: desc,
|
||||||
@ -703,7 +703,7 @@ func newOneof(gen *Plugin, f *File, message *Message, desc protoreflect.OneofDes
|
|||||||
Desc: desc,
|
Desc: desc,
|
||||||
ParentMessage: message,
|
ParentMessage: message,
|
||||||
GoName: camelCase(string(desc.Name())),
|
GoName: camelCase(string(desc.Name())),
|
||||||
Location: message.Location.appendPath(descfield.DescriptorProto_OneofDecl, int32(desc.Index())),
|
Location: message.Location.appendPath(fieldnum.DescriptorProto_OneofDecl, int32(desc.Index())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,9 +725,9 @@ type Enum struct {
|
|||||||
func newEnum(gen *Plugin, f *File, parent *Message, desc protoreflect.EnumDescriptor) *Enum {
|
func newEnum(gen *Plugin, f *File, parent *Message, desc protoreflect.EnumDescriptor) *Enum {
|
||||||
var loc Location
|
var loc Location
|
||||||
if parent != nil {
|
if parent != nil {
|
||||||
loc = parent.Location.appendPath(descfield.DescriptorProto_EnumType, int32(desc.Index()))
|
loc = parent.Location.appendPath(fieldnum.DescriptorProto_EnumType, int32(desc.Index()))
|
||||||
} else {
|
} else {
|
||||||
loc = f.location(descfield.FileDescriptorProto_EnumType, int32(desc.Index()))
|
loc = f.location(fieldnum.FileDescriptorProto_EnumType, int32(desc.Index()))
|
||||||
}
|
}
|
||||||
enum := &Enum{
|
enum := &Enum{
|
||||||
Desc: desc,
|
Desc: desc,
|
||||||
@ -762,7 +762,7 @@ func newEnumValue(gen *Plugin, f *File, message *Message, enum *Enum, desc proto
|
|||||||
return &EnumValue{
|
return &EnumValue{
|
||||||
Desc: desc,
|
Desc: desc,
|
||||||
GoIdent: f.GoImportPath.Ident(name),
|
GoIdent: f.GoImportPath.Ident(name),
|
||||||
Location: enum.Location.appendPath(descfield.EnumDescriptorProto_Value, int32(desc.Index())),
|
Location: enum.Location.appendPath(fieldnum.EnumDescriptorProto_Value, int32(desc.Index())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,7 +779,7 @@ func newService(gen *Plugin, f *File, desc protoreflect.ServiceDescriptor) *Serv
|
|||||||
service := &Service{
|
service := &Service{
|
||||||
Desc: desc,
|
Desc: desc,
|
||||||
GoName: camelCase(string(desc.Name())),
|
GoName: camelCase(string(desc.Name())),
|
||||||
Location: f.location(descfield.FileDescriptorProto_Service, int32(desc.Index())),
|
Location: f.location(fieldnum.FileDescriptorProto_Service, int32(desc.Index())),
|
||||||
}
|
}
|
||||||
for i, mdescs := 0, desc.Methods(); i < mdescs.Len(); i++ {
|
for i, mdescs := 0, desc.Methods(); i < mdescs.Len(); i++ {
|
||||||
service.Methods = append(service.Methods, newMethod(gen, f, service, mdescs.Get(i)))
|
service.Methods = append(service.Methods, newMethod(gen, f, service, mdescs.Get(i)))
|
||||||
@ -803,7 +803,7 @@ func newMethod(gen *Plugin, f *File, service *Service, desc protoreflect.MethodD
|
|||||||
Desc: desc,
|
Desc: desc,
|
||||||
GoName: camelCase(string(desc.Name())),
|
GoName: camelCase(string(desc.Name())),
|
||||||
ParentService: service,
|
ParentService: service,
|
||||||
Location: service.Location.appendPath(descfield.ServiceDescriptorProto_Method, int32(desc.Index())),
|
Location: service.Location.appendPath(fieldnum.ServiceDescriptorProto_Method, int32(desc.Index())),
|
||||||
}
|
}
|
||||||
return method
|
return method
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user