cmd/protoc-gen-go: group default consts and vars in blocks

Group the default constant and variable declarations together in a block
for better readability in godoc.

Change-Id: I6b62f5374f0302d0f7cb224cbe34102359c8c51d
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/189057
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
Joe Tsai 2019-08-05 17:59:14 -07:00
parent e815d6a43b
commit d29a71bff0
9 changed files with 227 additions and 162 deletions

View File

@ -402,7 +402,7 @@ func genMessage(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, me
g.P("}")
g.P()
genDefaultConsts(g, f, message)
genDefaultDecls(g, f, message)
genMessageMethods(gen, g, f, message)
genOneofWrapperTypes(gen, g, f, message)
}
@ -499,56 +499,61 @@ func genMessageField(g *protogen.GeneratedFile, f *fileInfo, message *protogen.M
sf.append(field.GoName)
}
// genDefaultConsts generates consts and vars holding the default
// genDefaultDecls generates consts and vars holding the default
// values of fields.
func genDefaultConsts(g *protogen.GeneratedFile, f *fileInfo, message *protogen.Message) {
func genDefaultDecls(g *protogen.GeneratedFile, f *fileInfo, message *protogen.Message) {
var consts, vars []string
for _, field := range message.Fields {
if !field.Desc.HasDefault() {
continue
}
defVarName := "Default_" + message.GoIdent.GoName + "_" + field.GoName
def := field.Desc.Default()
name := "Default_" + message.GoIdent.GoName + "_" + field.GoName
goType, _ := fieldGoType(g, f, field)
defVal := field.Desc.Default()
switch field.Desc.Kind() {
case protoreflect.StringKind:
g.P("const ", defVarName, " string = ", strconv.Quote(def.String()))
consts = append(consts, fmt.Sprintf("%s = %s(%q)", name, goType, defVal.String()))
case protoreflect.BytesKind:
g.P("var ", defVarName, " []byte = []byte(", strconv.Quote(string(def.Bytes())), ")")
vars = append(vars, fmt.Sprintf("%s = %s(%q)", name, goType, defVal.Bytes()))
case protoreflect.EnumKind:
evalueDesc := field.Desc.DefaultEnumValue()
enum := field.Enum
evalue := enum.Values[evalueDesc.Index()]
g.P("const ", defVarName, " ", field.Enum.GoIdent, " = ", evalue.GoIdent)
idx := field.Desc.DefaultEnumValue().Index()
val := field.Enum.Values[idx]
consts = append(consts, fmt.Sprintf("%s = %s", name, g.QualifiedGoIdent(val.GoIdent)))
case protoreflect.FloatKind, protoreflect.DoubleKind:
// Floating point numbers need extra handling for -Inf/Inf/NaN.
f := field.Desc.Default().Float()
goType := "float64"
if field.Desc.Kind() == protoreflect.FloatKind {
goType = "float32"
}
// funcCall returns a call to a function in the math package,
// possibly converting the result to float32.
funcCall := func(fn, param string) string {
s := g.QualifiedGoIdent(mathPackage.Ident(fn)) + param
if goType != "float64" {
s = goType + "(" + s + ")"
if f := defVal.Float(); math.IsNaN(f) || math.IsInf(f, 0) {
var fn, arg string
switch f := defVal.Float(); {
case math.IsInf(f, -1):
fn, arg = g.QualifiedGoIdent(mathPackage.Ident("Inf")), "-1"
case math.IsInf(f, +1):
fn, arg = g.QualifiedGoIdent(mathPackage.Ident("Inf")), "+1"
case math.IsNaN(f):
fn, arg = g.QualifiedGoIdent(mathPackage.Ident("NaN")), ""
}
return s
}
switch {
case math.IsInf(f, -1):
g.P("var ", defVarName, " ", goType, " = ", funcCall("Inf", "(-1)"))
case math.IsInf(f, 1):
g.P("var ", defVarName, " ", goType, " = ", funcCall("Inf", "(1)"))
case math.IsNaN(f):
g.P("var ", defVarName, " ", goType, " = ", funcCall("NaN", "()"))
default:
g.P("const ", defVarName, " ", goType, " = ", field.Desc.Default().Interface())
vars = append(vars, fmt.Sprintf("%s = %s(%s(%s))", name, goType, fn, arg))
} else {
consts = append(consts, fmt.Sprintf("%s = %s(%v)", name, goType, f))
}
default:
goType, _ := fieldGoType(g, f, field)
g.P("const ", defVarName, " ", goType, " = ", def.Interface())
consts = append(consts, fmt.Sprintf("%s = %s(%v)", name, goType, defVal.Interface()))
}
}
if len(consts) > 0 {
g.P("// Default values for ", message.GoIdent, " fields.")
g.P("const (")
for _, s := range consts {
g.P(s)
}
g.P(")")
}
if len(vars) > 0 {
g.P("// Default values for ", message.GoIdent, " fields.")
g.P("var (")
for _, s := range vars {
g.P(s)
}
g.P(")")
}
g.P()
}

View File

@ -194,10 +194,16 @@ type M struct {
OneofField isM_OneofField `protobuf_oneof:"oneof_field"`
}
const Default_M_S string = "default"
// Default values for M fields.
const (
Default_M_S = string("default")
)
var Default_M_B []byte = []byte("default")
var Default_M_F float64 = math.NaN()
// Default values for M fields.
var (
Default_M_B = []byte("default")
Default_M_F = float64(math.NaN())
)
func (x *M) Reset() {
*x = M{}

View File

@ -77,7 +77,10 @@ type Message struct {
EnumField *Enum `protobuf:"varint,2,opt,name=enum_field,json=enumField,enum=Enum,def=0" json:"enum_field,omitempty"`
}
const Default_Message_EnumField Enum = Enum_ZERO
// Default values for Message fields.
const (
Default_Message_EnumField = Enum_ZERO
)
func (x *Message) Reset() {
*x = Message{}

View File

@ -345,8 +345,11 @@ type EnumContainerMessage1 struct {
DefaultDuplicate2 *EnumType2 `protobuf:"varint,2,opt,name=default_duplicate2,json=defaultDuplicate2,enum=goproto.protoc.proto2.EnumType2,def=1" json:"default_duplicate2,omitempty"`
}
const Default_EnumContainerMessage1_DefaultDuplicate1 EnumType2 = EnumType2_duplicate1
const Default_EnumContainerMessage1_DefaultDuplicate2 EnumType2 = EnumType2_duplicate2
// Default values for EnumContainerMessage1 fields.
const (
Default_EnumContainerMessage1_DefaultDuplicate1 = EnumType2_duplicate1
Default_EnumContainerMessage1_DefaultDuplicate2 = EnumType2_duplicate2
)
func (x *EnumContainerMessage1) Reset() {
*x = EnumContainerMessage1{}

View File

@ -185,33 +185,37 @@ type FieldTestMessage struct {
OneofTwo isFieldTestMessage_OneofTwo `protobuf_oneof:"oneof_two"`
}
const Default_FieldTestMessage_DefaultBool bool = true
const Default_FieldTestMessage_DefaultEnum FieldTestMessage_Enum = FieldTestMessage_ONE
const Default_FieldTestMessage_DefaultInt32 int32 = 1
const Default_FieldTestMessage_DefaultSint32 int32 = 1
const Default_FieldTestMessage_DefaultUint32 uint32 = 1
const Default_FieldTestMessage_DefaultInt64 int64 = 1
const Default_FieldTestMessage_DefaultSint64 int64 = 1
const Default_FieldTestMessage_DefaultUint64 uint64 = 1
const Default_FieldTestMessage_DefaultSfixed32 int32 = 1
const Default_FieldTestMessage_DefaultFixed32 uint32 = 1
const Default_FieldTestMessage_DefaultFloat float32 = 3.14
const Default_FieldTestMessage_DefaultSfixed64 int64 = 1
const Default_FieldTestMessage_DefaultFixed64 uint64 = 1
const Default_FieldTestMessage_DefaultDouble float64 = 3.1415
const Default_FieldTestMessage_DefaultString string = "hello,\"world!\"\n"
// Default values for FieldTestMessage fields.
const (
Default_FieldTestMessage_DefaultBool = bool(true)
Default_FieldTestMessage_DefaultEnum = FieldTestMessage_ONE
Default_FieldTestMessage_DefaultInt32 = int32(1)
Default_FieldTestMessage_DefaultSint32 = int32(1)
Default_FieldTestMessage_DefaultUint32 = uint32(1)
Default_FieldTestMessage_DefaultInt64 = int64(1)
Default_FieldTestMessage_DefaultSint64 = int64(1)
Default_FieldTestMessage_DefaultUint64 = uint64(1)
Default_FieldTestMessage_DefaultSfixed32 = int32(1)
Default_FieldTestMessage_DefaultFixed32 = uint32(1)
Default_FieldTestMessage_DefaultFloat = float32(3.140000104904175)
Default_FieldTestMessage_DefaultSfixed64 = int64(1)
Default_FieldTestMessage_DefaultFixed64 = uint64(1)
Default_FieldTestMessage_DefaultDouble = float64(3.1415)
Default_FieldTestMessage_DefaultString = string("hello,\"world!\"\n")
Default_FieldTestMessage_DefaultZeroString = string("")
)
var Default_FieldTestMessage_DefaultBytes []byte = []byte("hello,ޭ\xbe\xef")
const Default_FieldTestMessage_DefaultZeroString string = ""
var Default_FieldTestMessage_DefaultZeroBytes []byte = []byte("")
var Default_FieldTestMessage_DefaultFloatNeginf float32 = float32(math.Inf(-1))
var Default_FieldTestMessage_DefaultFloatPosinf float32 = float32(math.Inf(1))
var Default_FieldTestMessage_DefaultFloatNan float32 = float32(math.NaN())
var Default_FieldTestMessage_DefaultDoubleNeginf float64 = math.Inf(-1)
var Default_FieldTestMessage_DefaultDoublePosinf float64 = math.Inf(1)
var Default_FieldTestMessage_DefaultDoubleNan float64 = math.NaN()
// Default values for FieldTestMessage fields.
var (
Default_FieldTestMessage_DefaultBytes = []byte("hello,ޭ\xbe\xef")
Default_FieldTestMessage_DefaultZeroBytes = []byte("")
Default_FieldTestMessage_DefaultFloatNeginf = float32(math.Inf(-1))
Default_FieldTestMessage_DefaultFloatPosinf = float32(math.Inf(+1))
Default_FieldTestMessage_DefaultFloatNan = float32(math.NaN())
Default_FieldTestMessage_DefaultDoubleNeginf = float64(math.Inf(-1))
Default_FieldTestMessage_DefaultDoublePosinf = float64(math.Inf(+1))
Default_FieldTestMessage_DefaultDoubleNan = float64(math.NaN())
)
func (x *FieldTestMessage) Reset() {
*x = FieldTestMessage{}

View File

@ -64,30 +64,33 @@ type GoogleMessage1 struct {
Field131 *int32 `protobuf:"varint,131,opt,name=field131,def=0" json:"field131,omitempty"`
}
const Default_GoogleMessage1_Field80 bool = false
const Default_GoogleMessage1_Field81 bool = true
const Default_GoogleMessage1_Field6 int32 = 0
const Default_GoogleMessage1_Field59 bool = false
const Default_GoogleMessage1_Field130 int32 = 0
const Default_GoogleMessage1_Field12 bool = true
const Default_GoogleMessage1_Field17 bool = true
const Default_GoogleMessage1_Field13 bool = true
const Default_GoogleMessage1_Field14 bool = true
const Default_GoogleMessage1_Field104 int32 = 0
const Default_GoogleMessage1_Field100 int32 = 0
const Default_GoogleMessage1_Field101 int32 = 0
const Default_GoogleMessage1_Field29 int32 = 0
const Default_GoogleMessage1_Field30 bool = false
const Default_GoogleMessage1_Field60 int32 = -1
const Default_GoogleMessage1_Field271 int32 = -1
const Default_GoogleMessage1_Field272 int32 = -1
const Default_GoogleMessage1_Field23 int32 = 0
const Default_GoogleMessage1_Field24 bool = false
const Default_GoogleMessage1_Field25 int32 = 0
const Default_GoogleMessage1_Field67 int32 = 0
const Default_GoogleMessage1_Field128 int32 = 0
const Default_GoogleMessage1_Field129 string = "xxxxxxxxxxxxxxxxxxxxx"
const Default_GoogleMessage1_Field131 int32 = 0
// Default values for GoogleMessage1 fields.
const (
Default_GoogleMessage1_Field80 = bool(false)
Default_GoogleMessage1_Field81 = bool(true)
Default_GoogleMessage1_Field6 = int32(0)
Default_GoogleMessage1_Field59 = bool(false)
Default_GoogleMessage1_Field130 = int32(0)
Default_GoogleMessage1_Field12 = bool(true)
Default_GoogleMessage1_Field17 = bool(true)
Default_GoogleMessage1_Field13 = bool(true)
Default_GoogleMessage1_Field14 = bool(true)
Default_GoogleMessage1_Field104 = int32(0)
Default_GoogleMessage1_Field100 = int32(0)
Default_GoogleMessage1_Field101 = int32(0)
Default_GoogleMessage1_Field29 = int32(0)
Default_GoogleMessage1_Field30 = bool(false)
Default_GoogleMessage1_Field60 = int32(-1)
Default_GoogleMessage1_Field271 = int32(-1)
Default_GoogleMessage1_Field272 = int32(-1)
Default_GoogleMessage1_Field23 = int32(0)
Default_GoogleMessage1_Field24 = bool(false)
Default_GoogleMessage1_Field25 = int32(0)
Default_GoogleMessage1_Field67 = int32(0)
Default_GoogleMessage1_Field128 = int32(0)
Default_GoogleMessage1_Field129 = string("xxxxxxxxxxxxxxxxxxxxx")
Default_GoogleMessage1_Field131 = int32(0)
)
func (x *GoogleMessage1) Reset() {
*x = GoogleMessage1{}
@ -429,15 +432,18 @@ type GoogleMessage1SubMessage struct {
Field300 *uint64 `protobuf:"varint,300,opt,name=field300" json:"field300,omitempty"`
}
const Default_GoogleMessage1SubMessage_Field1 int32 = 0
const Default_GoogleMessage1SubMessage_Field2 int32 = 0
const Default_GoogleMessage1SubMessage_Field3 int32 = 0
const Default_GoogleMessage1SubMessage_Field12 bool = true
const Default_GoogleMessage1SubMessage_Field19 int32 = 2
const Default_GoogleMessage1SubMessage_Field20 bool = true
const Default_GoogleMessage1SubMessage_Field28 bool = true
const Default_GoogleMessage1SubMessage_Field23 bool = false
const Default_GoogleMessage1SubMessage_Field206 bool = false
// Default values for GoogleMessage1SubMessage fields.
const (
Default_GoogleMessage1SubMessage_Field1 = int32(0)
Default_GoogleMessage1SubMessage_Field2 = int32(0)
Default_GoogleMessage1SubMessage_Field3 = int32(0)
Default_GoogleMessage1SubMessage_Field12 = bool(true)
Default_GoogleMessage1SubMessage_Field19 = int32(2)
Default_GoogleMessage1SubMessage_Field20 = bool(true)
Default_GoogleMessage1SubMessage_Field28 = bool(true)
Default_GoogleMessage1SubMessage_Field23 = bool(false)
Default_GoogleMessage1SubMessage_Field206 = bool(false)
)
func (x *GoogleMessage1SubMessage) Reset() {
*x = GoogleMessage1SubMessage{}

View File

@ -53,21 +53,24 @@ type GoogleMessage2 struct {
Field206 *bool `protobuf:"varint,206,opt,name=field206,def=0" json:"field206,omitempty"`
}
const Default_GoogleMessage2_Field75 bool = false
const Default_GoogleMessage2_Field21 int32 = 0
const Default_GoogleMessage2_Field109 int32 = 0
const Default_GoogleMessage2_Field210 int32 = 0
const Default_GoogleMessage2_Field211 int32 = 0
const Default_GoogleMessage2_Field212 int32 = 0
const Default_GoogleMessage2_Field213 int32 = 0
const Default_GoogleMessage2_Field216 int32 = 0
const Default_GoogleMessage2_Field217 int32 = 0
const Default_GoogleMessage2_Field218 int32 = 0
const Default_GoogleMessage2_Field220 int32 = 0
const Default_GoogleMessage2_Field221 int32 = 0
const Default_GoogleMessage2_Field222 float32 = 0
const Default_GoogleMessage2_Field205 bool = false
const Default_GoogleMessage2_Field206 bool = false
// Default values for GoogleMessage2 fields.
const (
Default_GoogleMessage2_Field75 = bool(false)
Default_GoogleMessage2_Field21 = int32(0)
Default_GoogleMessage2_Field109 = int32(0)
Default_GoogleMessage2_Field210 = int32(0)
Default_GoogleMessage2_Field211 = int32(0)
Default_GoogleMessage2_Field212 = int32(0)
Default_GoogleMessage2_Field213 = int32(0)
Default_GoogleMessage2_Field216 = int32(0)
Default_GoogleMessage2_Field217 = int32(0)
Default_GoogleMessage2_Field218 = int32(0)
Default_GoogleMessage2_Field220 = int32(0)
Default_GoogleMessage2_Field221 = int32(0)
Default_GoogleMessage2_Field222 = float32(0)
Default_GoogleMessage2_Field205 = bool(false)
Default_GoogleMessage2_Field206 = bool(false)
)
func (x *GoogleMessage2) Reset() {
*x = GoogleMessage2{}
@ -323,9 +326,12 @@ type GoogleMessage2GroupedMessage struct {
Field11 *int64 `protobuf:"varint,11,opt,name=field11" json:"field11,omitempty"`
}
const Default_GoogleMessage2GroupedMessage_Field3 float32 = 0
const Default_GoogleMessage2GroupedMessage_Field6 bool = true
const Default_GoogleMessage2GroupedMessage_Field7 bool = false
// Default values for GoogleMessage2GroupedMessage fields.
const (
Default_GoogleMessage2GroupedMessage_Field3 = float32(0)
Default_GoogleMessage2GroupedMessage_Field6 = bool(true)
Default_GoogleMessage2GroupedMessage_Field7 = bool(false)
)
func (x *GoogleMessage2GroupedMessage) Reset() {
*x = GoogleMessage2GroupedMessage{}
@ -453,7 +459,10 @@ type GoogleMessage2_Group1 struct {
Field31 *GoogleMessage2GroupedMessage `protobuf:"bytes,31,opt,name=field31" json:"field31,omitempty"`
}
const Default_GoogleMessage2_Group1_Field20 int32 = 0
// Default values for GoogleMessage2_Group1 fields.
const (
Default_GoogleMessage2_Group1_Field20 = int32(0)
)
func (x *GoogleMessage2_Group1) Reset() {
*x = GoogleMessage2_Group1{}

View File

@ -333,25 +333,30 @@ type TestAllTypes struct {
OneofField isTestAllTypes_OneofField `protobuf_oneof:"oneof_field"`
}
const Default_TestAllTypes_DefaultInt32 int32 = 81
const Default_TestAllTypes_DefaultInt64 int64 = 82
const Default_TestAllTypes_DefaultUint32 uint32 = 83
const Default_TestAllTypes_DefaultUint64 uint64 = 84
const Default_TestAllTypes_DefaultSint32 int32 = -85
const Default_TestAllTypes_DefaultSint64 int64 = 86
const Default_TestAllTypes_DefaultFixed32 uint32 = 87
const Default_TestAllTypes_DefaultFixed64 uint64 = 88
const Default_TestAllTypes_DefaultSfixed32 int32 = 89
const Default_TestAllTypes_DefaultSfixed64 int64 = -90
const Default_TestAllTypes_DefaultFloat float32 = 91.5
const Default_TestAllTypes_DefaultDouble float64 = 92000
const Default_TestAllTypes_DefaultBool bool = true
const Default_TestAllTypes_DefaultString string = "hello"
// Default values for TestAllTypes fields.
const (
Default_TestAllTypes_DefaultInt32 = int32(81)
Default_TestAllTypes_DefaultInt64 = int64(82)
Default_TestAllTypes_DefaultUint32 = uint32(83)
Default_TestAllTypes_DefaultUint64 = uint64(84)
Default_TestAllTypes_DefaultSint32 = int32(-85)
Default_TestAllTypes_DefaultSint64 = int64(86)
Default_TestAllTypes_DefaultFixed32 = uint32(87)
Default_TestAllTypes_DefaultFixed64 = uint64(88)
Default_TestAllTypes_DefaultSfixed32 = int32(89)
Default_TestAllTypes_DefaultSfixed64 = int64(-90)
Default_TestAllTypes_DefaultFloat = float32(91.5)
Default_TestAllTypes_DefaultDouble = float64(92000)
Default_TestAllTypes_DefaultBool = bool(true)
Default_TestAllTypes_DefaultString = string("hello")
Default_TestAllTypes_DefaultNestedEnum = TestAllTypes_BAR
Default_TestAllTypes_DefaultForeignEnum = ForeignEnum_FOREIGN_BAR
)
var Default_TestAllTypes_DefaultBytes []byte = []byte("world")
const Default_TestAllTypes_DefaultNestedEnum TestAllTypes_NestedEnum = TestAllTypes_BAR
const Default_TestAllTypes_DefaultForeignEnum ForeignEnum = ForeignEnum_FOREIGN_BAR
// Default values for TestAllTypes fields.
var (
Default_TestAllTypes_DefaultBytes = []byte("world")
)
func (x *TestAllTypes) Reset() {
*x = TestAllTypes{}

View File

@ -1175,8 +1175,11 @@ type MethodDescriptorProto struct {
ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"`
}
const Default_MethodDescriptorProto_ClientStreaming bool = false
const Default_MethodDescriptorProto_ServerStreaming bool = false
// Default values for MethodDescriptorProto fields.
const (
Default_MethodDescriptorProto_ClientStreaming = bool(false)
Default_MethodDescriptorProto_ServerStreaming = bool(false)
)
func (x *MethodDescriptorProto) Reset() {
*x = MethodDescriptorProto{}
@ -1338,15 +1341,18 @@ type FileOptions struct {
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
}
const Default_FileOptions_JavaMultipleFiles bool = false
const Default_FileOptions_JavaStringCheckUtf8 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_PhpGenericServices bool = false
const Default_FileOptions_Deprecated bool = false
const Default_FileOptions_CcEnableArenas bool = false
// Default values for FileOptions fields.
const (
Default_FileOptions_JavaMultipleFiles = bool(false)
Default_FileOptions_JavaStringCheckUtf8 = bool(false)
Default_FileOptions_OptimizeFor = FileOptions_SPEED
Default_FileOptions_CcGenericServices = bool(false)
Default_FileOptions_JavaGenericServices = bool(false)
Default_FileOptions_PyGenericServices = bool(false)
Default_FileOptions_PhpGenericServices = bool(false)
Default_FileOptions_Deprecated = bool(false)
Default_FileOptions_CcEnableArenas = bool(false)
)
func (x *FileOptions) Reset() {
*x = FileOptions{}
@ -1591,9 +1597,12 @@ type MessageOptions struct {
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
}
const Default_MessageOptions_MessageSetWireFormat bool = false
const Default_MessageOptions_NoStandardDescriptorAccessor bool = false
const Default_MessageOptions_Deprecated bool = false
// Default values for MessageOptions fields.
const (
Default_MessageOptions_MessageSetWireFormat = bool(false)
Default_MessageOptions_NoStandardDescriptorAccessor = bool(false)
Default_MessageOptions_Deprecated = bool(false)
)
func (x *MessageOptions) Reset() {
*x = MessageOptions{}
@ -1734,11 +1743,14 @@ type FieldOptions struct {
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
}
const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING
const Default_FieldOptions_Jstype FieldOptions_JSType = FieldOptions_JS_NORMAL
const Default_FieldOptions_Lazy bool = false
const Default_FieldOptions_Deprecated bool = false
const Default_FieldOptions_Weak bool = false
// Default values for FieldOptions fields.
const (
Default_FieldOptions_Ctype = FieldOptions_STRING
Default_FieldOptions_Jstype = FieldOptions_JS_NORMAL
Default_FieldOptions_Lazy = bool(false)
Default_FieldOptions_Deprecated = bool(false)
Default_FieldOptions_Weak = bool(false)
)
func (x *FieldOptions) Reset() {
*x = FieldOptions{}
@ -1894,7 +1906,10 @@ type EnumOptions struct {
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
}
const Default_EnumOptions_Deprecated bool = false
// Default values for EnumOptions fields.
const (
Default_EnumOptions_Deprecated = bool(false)
)
func (x *EnumOptions) Reset() {
*x = EnumOptions{}
@ -1967,7 +1982,10 @@ type EnumValueOptions struct {
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
}
const Default_EnumValueOptions_Deprecated bool = false
// Default values for EnumValueOptions fields.
const (
Default_EnumValueOptions_Deprecated = bool(false)
)
func (x *EnumValueOptions) Reset() {
*x = EnumValueOptions{}
@ -2033,7 +2051,10 @@ type ServiceOptions struct {
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
}
const Default_ServiceOptions_Deprecated bool = false
// Default values for ServiceOptions fields.
const (
Default_ServiceOptions_Deprecated = bool(false)
)
func (x *ServiceOptions) Reset() {
*x = ServiceOptions{}
@ -2100,8 +2121,11 @@ type MethodOptions struct {
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
}
const Default_MethodOptions_Deprecated bool = false
const Default_MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN
// Default values for MethodOptions fields.
const (
Default_MethodOptions_Deprecated = bool(false)
Default_MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN
)
func (x *MethodOptions) Reset() {
*x = MethodOptions{}