| 1 |
// Copyright 2018 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
// Code generated by protoc-gen-go. DO NOT EDIT. |
| 6 |
// source: cmd/protoc-gen-go/testdata/fieldnames/fieldnames.proto |
| 7 |
|
| 8 |
package fieldnames |
| 9 |
|
| 10 |
import ( |
| 11 |
protoreflect "google.golang.org/protobuf/reflect/protoreflect" |
| 12 |
protoimpl "google.golang.org/protobuf/runtime/protoimpl" |
| 13 |
reflect "reflect" |
| 14 |
sync "sync" |
| 15 |
unsafe "unsafe" |
| 16 |
) |
| 17 |
|
| 18 |
// Assorted edge cases in field name conflict resolution. |
| 19 |
// |
| 20 |
// Not all (or possibly any) of these behave in an easily-understood fashion. |
| 21 |
// This exists to demonstrate the current behavior and catch unintended |
| 22 |
// changes in it. |
| 23 |
type Message struct { |
| 24 |
state protoimpl.MessageState `protogen:"open.v1"` |
| 25 |
// Various CamelCase conversions. |
| 26 |
FieldOne *string `protobuf:"bytes,1,opt,name=field_one,json=fieldOne" json:"field_one,omitempty"` |
| 27 |
FieldTwo *string `protobuf:"bytes,2,opt,name=FieldTwo" json:"FieldTwo,omitempty"` |
| 28 |
FieldThree *string `protobuf:"bytes,3,opt,name=fieldThree" json:"fieldThree,omitempty"` |
| 29 |
Field_Four *string `protobuf:"bytes,4,opt,name=field__four,json=fieldFour" json:"field__four,omitempty"` |
| 30 |
// Field names that conflict with standard methods on the message struct. |
| 31 |
Descriptor_ *string `protobuf:"bytes,10,opt,name=descriptor" json:"descriptor,omitempty"` |
| 32 |
Marshal_ *string `protobuf:"bytes,11,opt,name=marshal" json:"marshal,omitempty"` |
| 33 |
Unmarshal_ *string `protobuf:"bytes,12,opt,name=unmarshal" json:"unmarshal,omitempty"` |
| 34 |
ProtoMessage_ *string `protobuf:"bytes,13,opt,name=proto_message,json=protoMessage" json:"proto_message,omitempty"` |
| 35 |
// Field names that conflict with each other after CamelCasing. |
| 36 |
CamelCase *string `protobuf:"bytes,20,opt,name=CamelCase" json:"CamelCase,omitempty"` |
| 37 |
CamelCase_ *string `protobuf:"bytes,21,opt,name=CamelCase_,json=CamelCase" json:"CamelCase_,omitempty"` |
| 38 |
CamelCase__ *string `protobuf:"bytes,22,opt,name=camel_case,json=camelCase" json:"camel_case,omitempty"` // conflicts with 20, 21 |
| 39 |
CamelCase___ *string `protobuf:"bytes,23,opt,name=CamelCase__,json=CamelCase" json:"CamelCase__,omitempty"` // conflicts with 21, 21, renamed 22 |
| 40 |
// Field with a getter that conflicts with another field. |
| 41 |
GetName *string `protobuf:"bytes,30,opt,name=get_name,json=getName" json:"get_name,omitempty"` |
| 42 |
Name_ *string `protobuf:"bytes,31,opt,name=name" json:"name,omitempty"` |
| 43 |
// Oneof that conflicts with its first field: The oneof is renamed. |
| 44 |
// |
| 45 |
// Types that are valid to be assigned to OneofConflictA_: |
| 46 |
// |
| 47 |
// *Message_OneofConflictA |
| 48 |
OneofConflictA_ isMessage_OneofConflictA_ `protobuf_oneof:"oneof_conflict_a"` |
| 49 |
// Oneof that conflicts with its second field: The field is renamed. |
| 50 |
// |
| 51 |
// Types that are valid to be assigned to OneofConflictB: |
| 52 |
// |
| 53 |
// *Message_OneofNoConflict |
| 54 |
// *Message_OneofConflictB_ |
| 55 |
OneofConflictB isMessage_OneofConflictB `protobuf_oneof:"oneof_conflict_b"` |
| 56 |
// Oneof with a field name that conflicts with a nested message. |
| 57 |
// |
| 58 |
// Types that are valid to be assigned to OneofConflictC: |
| 59 |
// |
| 60 |
// *Message_OneofMessageConflict_ |
| 61 |
OneofConflictC isMessage_OneofConflictC `protobuf_oneof:"oneof_conflict_c"` |
| 62 |
unknownFields protoimpl.UnknownFields |
| 63 |
sizeCache protoimpl.SizeCache |
| 64 |
} |
| 65 |
|
| 66 |
func (x *Message) Reset() { |
| 67 |
*x = Message{} |
| 68 |
mi := &file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_msgTypes[0] |
| 69 |
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| 70 |
ms.StoreMessageInfo(mi) |
| 71 |
} |
| 72 |
|
| 73 |
func (x *Message) String() string { |
| 74 |
return protoimpl.X.MessageStringOf(x) |
| 75 |
} |
| 76 |
|
| 77 |
func (*Message) ProtoMessage() {} |
| 78 |
|
| 79 |
func (x *Message) ProtoReflect() protoreflect.Message { |
| 80 |
mi := &file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_msgTypes[0] |
| 81 |
if x != nil { |
| 82 |
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| 83 |
if ms.LoadMessageInfo() == nil { |
| 84 |
ms.StoreMessageInfo(mi) |
| 85 |
} |
| 86 |
return ms |
| 87 |
} |
| 88 |
return mi.MessageOf(x) |
| 89 |
} |
| 90 |
|
| 91 |
// Deprecated: Use Message.ProtoReflect.Descriptor instead. |
| 92 |
func (*Message) Descriptor() ([]byte, []int) { |
| 93 |
return file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_rawDescGZIP(), []int{0} |
| 94 |
} |
| 95 |
|
| 96 |
func (x *Message) GetFieldOne() string { |
| 97 |
if x != nil && x.FieldOne != nil { |
| 98 |
return *x.FieldOne |
| 99 |
} |
| 100 |
return "" |
| 101 |
} |
| 102 |
|
| 103 |
func (x *Message) GetFieldTwo() string { |
| 104 |
if x != nil && x.FieldTwo != nil { |
| 105 |
return *x.FieldTwo |
| 106 |
} |
| 107 |
return "" |
| 108 |
} |
| 109 |
|
| 110 |
func (x *Message) GetFieldThree() string { |
| 111 |
if x != nil && x.FieldThree != nil { |
| 112 |
return *x.FieldThree |
| 113 |
} |
| 114 |
return "" |
| 115 |
} |
| 116 |
|
| 117 |
func (x *Message) GetField_Four() string { |
| 118 |
if x != nil && x.Field_Four != nil { |
| 119 |
return *x.Field_Four |
| 120 |
} |
| 121 |
return "" |
| 122 |
} |
| 123 |
|
| 124 |
func (x *Message) GetDescriptor_() string { |
| 125 |
if x != nil && x.Descriptor_ != nil { |
| 126 |
return *x.Descriptor_ |
| 127 |
} |
| 128 |
return "" |
| 129 |
} |
| 130 |
|
| 131 |
func (x *Message) GetMarshal_() string { |
| 132 |
if x != nil && x.Marshal_ != nil { |
| 133 |
return *x.Marshal_ |
| 134 |
} |
| 135 |
return "" |
| 136 |
} |
| 137 |
|
| 138 |
func (x *Message) GetUnmarshal_() string { |
| 139 |
if x != nil && x.Unmarshal_ != nil { |
| 140 |
return *x.Unmarshal_ |
| 141 |
} |
| 142 |
return "" |
| 143 |
} |
| 144 |
|
| 145 |
func (x *Message) GetProtoMessage_() string { |
| 146 |
if x != nil && x.ProtoMessage_ != nil { |
| 147 |
return *x.ProtoMessage_ |
| 148 |
} |
| 149 |
return "" |
| 150 |
} |
| 151 |
|
| 152 |
func (x *Message) GetCamelCase() string { |
| 153 |
if x != nil && x.CamelCase != nil { |
| 154 |
return *x.CamelCase |
| 155 |
} |
| 156 |
return "" |
| 157 |
} |
| 158 |
|
| 159 |
func (x *Message) GetCamelCase_() string { |
| 160 |
if x != nil && x.CamelCase_ != nil { |
| 161 |
return *x.CamelCase_ |
| 162 |
} |
| 163 |
return "" |
| 164 |
} |
| 165 |
|
| 166 |
func (x *Message) GetCamelCase__() string { |
| 167 |
if x != nil && x.CamelCase__ != nil { |
| 168 |
return *x.CamelCase__ |
| 169 |
} |
| 170 |
return "" |
| 171 |
} |
| 172 |
|
| 173 |
func (x *Message) GetCamelCase___() string { |
| 174 |
if x != nil && x.CamelCase___ != nil { |
| 175 |
return *x.CamelCase___ |
| 176 |
} |
| 177 |
return "" |
| 178 |
} |
| 179 |
|
| 180 |
func (x *Message) GetGetName() string { |
| 181 |
if x != nil && x.GetName != nil { |
| 182 |
return *x.GetName |
| 183 |
} |
| 184 |
return "" |
| 185 |
} |
| 186 |
|
| 187 |
func (x *Message) GetName_() string { |
| 188 |
if x != nil && x.Name_ != nil { |
| 189 |
return *x.Name_ |
| 190 |
} |
| 191 |
return "" |
| 192 |
} |
| 193 |
|
| 194 |
func (x *Message) GetOneofConflictA_() isMessage_OneofConflictA_ { |
| 195 |
if x != nil { |
| 196 |
return x.OneofConflictA_ |
| 197 |
} |
| 198 |
return nil |
| 199 |
} |
| 200 |
|
| 201 |
func (x *Message) GetOneofConflictA() string { |
| 202 |
if x != nil { |
| 203 |
if x, ok := x.OneofConflictA_.(*Message_OneofConflictA); ok { |
| 204 |
return x.OneofConflictA |
| 205 |
} |
| 206 |
} |
| 207 |
return "" |
| 208 |
} |
| 209 |
|
| 210 |
func (x *Message) GetOneofConflictB() isMessage_OneofConflictB { |
| 211 |
if x != nil { |
| 212 |
return x.OneofConflictB |
| 213 |
} |
| 214 |
return nil |
| 215 |
} |
| 216 |
|
| 217 |
func (x *Message) GetOneofNoConflict() string { |
| 218 |
if x != nil { |
| 219 |
if x, ok := x.OneofConflictB.(*Message_OneofNoConflict); ok { |
| 220 |
return x.OneofNoConflict |
| 221 |
} |
| 222 |
} |
| 223 |
return "" |
| 224 |
} |
| 225 |
|
| 226 |
func (x *Message) GetOneofConflictB_() string { |
| 227 |
if x != nil { |
| 228 |
if x, ok := x.OneofConflictB.(*Message_OneofConflictB_); ok { |
| 229 |
return x.OneofConflictB_ |
| 230 |
} |
| 231 |
} |
| 232 |
return "" |
| 233 |
} |
| 234 |
|
| 235 |
func (x *Message) GetOneofConflictC() isMessage_OneofConflictC { |
| 236 |
if x != nil { |
| 237 |
return x.OneofConflictC |
| 238 |
} |
| 239 |
return nil |
| 240 |
} |
| 241 |
|
| 242 |
func (x *Message) GetOneofMessageConflict() string { |
| 243 |
if x != nil { |
| 244 |
if x, ok := x.OneofConflictC.(*Message_OneofMessageConflict_); ok { |
| 245 |
return x.OneofMessageConflict |
| 246 |
} |
| 247 |
} |
| 248 |
return "" |
| 249 |
} |
| 250 |
|
| 251 |
type isMessage_OneofConflictA_ interface { |
| 252 |
isMessage_OneofConflictA_() |
| 253 |
} |
| 254 |
|
| 255 |
type Message_OneofConflictA struct { |
| 256 |
OneofConflictA string `protobuf:"bytes,40,opt,name=OneofConflictA,oneof"` |
| 257 |
} |
| 258 |
|
| 259 |
func (*Message_OneofConflictA) isMessage_OneofConflictA_() {} |
| 260 |
|
| 261 |
type isMessage_OneofConflictB interface { |
| 262 |
isMessage_OneofConflictB() |
| 263 |
} |
| 264 |
|
| 265 |
type Message_OneofNoConflict struct { |
| 266 |
OneofNoConflict string `protobuf:"bytes,50,opt,name=oneof_no_conflict,json=oneofNoConflict,oneof"` |
| 267 |
} |
| 268 |
|
| 269 |
type Message_OneofConflictB_ struct { |
| 270 |
OneofConflictB_ string `protobuf:"bytes,51,opt,name=OneofConflictB,oneof"` |
| 271 |
} |
| 272 |
|
| 273 |
func (*Message_OneofNoConflict) isMessage_OneofConflictB() {} |
| 274 |
|
| 275 |
func (*Message_OneofConflictB_) isMessage_OneofConflictB() {} |
| 276 |
|
| 277 |
type isMessage_OneofConflictC interface { |
| 278 |
isMessage_OneofConflictC() |
| 279 |
} |
| 280 |
|
| 281 |
type Message_OneofMessageConflict_ struct { |
| 282 |
OneofMessageConflict string `protobuf:"bytes,60,opt,name=oneof_message_conflict,json=oneofMessageConflict,oneof"` |
| 283 |
} |
| 284 |
|
| 285 |
func (*Message_OneofMessageConflict_) isMessage_OneofConflictC() {} |
| 286 |
|
| 287 |
type Message_OneofMessageConflict struct { |
| 288 |
state protoimpl.MessageState `protogen:"open.v1"` |
| 289 |
unknownFields protoimpl.UnknownFields |
| 290 |
sizeCache protoimpl.SizeCache |
| 291 |
} |
| 292 |
|
| 293 |
func (x *Message_OneofMessageConflict) Reset() { |
| 294 |
*x = Message_OneofMessageConflict{} |
| 295 |
mi := &file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_msgTypes[1] |
| 296 |
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| 297 |
ms.StoreMessageInfo(mi) |
| 298 |
} |
| 299 |
|
| 300 |
func (x *Message_OneofMessageConflict) String() string { |
| 301 |
return protoimpl.X.MessageStringOf(x) |
| 302 |
} |
| 303 |
|
| 304 |
func (*Message_OneofMessageConflict) ProtoMessage() {} |
| 305 |
|
| 306 |
func (x *Message_OneofMessageConflict) ProtoReflect() protoreflect.Message { |
| 307 |
mi := &file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_msgTypes[1] |
| 308 |
if x != nil { |
| 309 |
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| 310 |
if ms.LoadMessageInfo() == nil { |
| 311 |
ms.StoreMessageInfo(mi) |
| 312 |
} |
| 313 |
return ms |
| 314 |
} |
| 315 |
return mi.MessageOf(x) |
| 316 |
} |
| 317 |
|
| 318 |
// Deprecated: Use Message_OneofMessageConflict.ProtoReflect.Descriptor instead. |
| 319 |
func (*Message_OneofMessageConflict) Descriptor() ([]byte, []int) { |
| 320 |
return file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_rawDescGZIP(), []int{0, 0} |
| 321 |
} |
| 322 |
|
| 323 |
var File_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto protoreflect.FileDescriptor |
| 324 |
|
| 325 |
const file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_rawDesc = "" + |
| 326 |
"\n" + |
| 327 |
"6cmd/protoc-gen-go/testdata/fieldnames/fieldnames.proto\x12\x19goproto.protoc.fieldnames\"\xb8\x05\n" + |
| 328 |
"\aMessage\x12\x1b\n" + |
| 329 |
"\tfield_one\x18\x01 \x01(\tR\bfieldOne\x12\x1a\n" + |
| 330 |
"\bFieldTwo\x18\x02 \x01(\tR\bFieldTwo\x12\x1e\n" + |
| 331 |
"\n" + |
| 332 |
"fieldThree\x18\x03 \x01(\tR\n" + |
| 333 |
"fieldThree\x12\x1e\n" + |
| 334 |
"\vfield__four\x18\x04 \x01(\tR\tfieldFour\x12\x1e\n" + |
| 335 |
"\n" + |
| 336 |
"descriptor\x18\n" + |
| 337 |
" \x01(\tR\n" + |
| 338 |
"descriptor\x12\x18\n" + |
| 339 |
"\amarshal\x18\v \x01(\tR\amarshal\x12\x1c\n" + |
| 340 |
"\tunmarshal\x18\f \x01(\tR\tunmarshal\x12#\n" + |
| 341 |
"\rproto_message\x18\r \x01(\tR\fprotoMessage\x12\x1c\n" + |
| 342 |
"\tCamelCase\x18\x14 \x01(\tR\tCamelCase\x12\x1d\n" + |
| 343 |
"\n" + |
| 344 |
"CamelCase_\x18\x15 \x01(\tR\tCamelCase\x12\x1d\n" + |
| 345 |
"\n" + |
| 346 |
"camel_case\x18\x16 \x01(\tR\tcamelCase\x12\x1e\n" + |
| 347 |
"\vCamelCase__\x18\x17 \x01(\tR\tCamelCase\x12\x19\n" + |
| 348 |
"\bget_name\x18\x1e \x01(\tR\agetName\x12\x12\n" + |
| 349 |
"\x04name\x18\x1f \x01(\tR\x04name\x12(\n" + |
| 350 |
"\x0eOneofConflictA\x18( \x01(\tH\x00R\x0eOneofConflictA\x12,\n" + |
| 351 |
"\x11oneof_no_conflict\x182 \x01(\tH\x01R\x0foneofNoConflict\x12(\n" + |
| 352 |
"\x0eOneofConflictB\x183 \x01(\tH\x01R\x0eOneofConflictB\x126\n" + |
| 353 |
"\x16oneof_message_conflict\x18< \x01(\tH\x02R\x14oneofMessageConflict\x1a\x16\n" + |
| 354 |
"\x14OneofMessageConflictB\x12\n" + |
| 355 |
"\x10oneof_conflict_aB\x12\n" + |
| 356 |
"\x10oneof_conflict_bB\x12\n" + |
| 357 |
"\[email protected]/protobuf/cmd/protoc-gen-go/testdata/fieldnames" |
| 358 |
|
| 359 |
var ( |
| 360 |
file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_rawDescOnce sync.Once |
| 361 |
file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_rawDescData []byte |
| 362 |
) |
| 363 |
|
| 364 |
func file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_rawDescGZIP() []byte { |
| 365 |
file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_rawDescOnce.Do(func() { |
| 366 |
file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_rawDesc), len(file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_rawDesc))) |
| 367 |
}) |
| 368 |
return file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_rawDescData |
| 369 |
} |
| 370 |
|
| 371 |
var file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_msgTypes = make([]protoimpl.MessageInfo, 2) |
| 372 |
var file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_goTypes = []any{ |
| 373 |
(*Message)(nil), // 0: goproto.protoc.fieldnames.Message |
| 374 |
(*Message_OneofMessageConflict)(nil), // 1: goproto.protoc.fieldnames.Message.OneofMessageConflict |
| 375 |
} |
| 376 |
var file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_depIdxs = []int32{ |
| 377 |
0, // [0:0] is the sub-list for method output_type |
| 378 |
0, // [0:0] is the sub-list for method input_type |
| 379 |
0, // [0:0] is the sub-list for extension type_name |
| 380 |
0, // [0:0] is the sub-list for extension extendee |
| 381 |
0, // [0:0] is the sub-list for field type_name |
| 382 |
} |
| 383 |
|
| 384 |
func init() { file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_init() } |
| 385 |
func file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_init() { |
| 386 |
if File_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto != nil { |
| 387 |
return |
| 388 |
} |
| 389 |
file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_msgTypes[0].OneofWrappers = []any{ |
| 390 |
(*Message_OneofConflictA)(nil), |
| 391 |
(*Message_OneofNoConflict)(nil), |
| 392 |
(*Message_OneofConflictB_)(nil), |
| 393 |
(*Message_OneofMessageConflict_)(nil), |
| 394 |
} |
| 395 |
type x struct{} |
| 396 |
out := protoimpl.TypeBuilder{ |
| 397 |
File: protoimpl.DescBuilder{ |
| 398 |
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), |
| 399 |
RawDescriptor: unsafe.Slice(unsafe.StringData(file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_rawDesc), len(file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_rawDesc)), |
| 400 |
NumEnums: 0, |
| 401 |
NumMessages: 2, |
| 402 |
NumExtensions: 0, |
| 403 |
NumServices: 0, |
| 404 |
}, |
| 405 |
GoTypes: file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_goTypes, |
| 406 |
DependencyIndexes: file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_depIdxs, |
| 407 |
MessageInfos: file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_msgTypes, |
| 408 |
}.Build() |
| 409 |
File_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto = out.File |
| 410 |
file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_goTypes = nil |
| 411 |
file_cmd_protoc_gen_go_testdata_fieldnames_fieldnames_proto_depIdxs = nil |
| 412 |
} |