| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package nopackage |
| 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 |
type Enum int32 |
| 19 |
|
| 20 |
const ( |
| 21 |
Enum_ZERO Enum = 0 |
| 22 |
) |
| 23 |
|
| 24 |
|
| 25 |
var ( |
| 26 |
Enum_name = map[int32]string{ |
| 27 |
0: "ZERO", |
| 28 |
} |
| 29 |
Enum_value = map[string]int32{ |
| 30 |
"ZERO": 0, |
| 31 |
} |
| 32 |
) |
| 33 |
|
| 34 |
func (x Enum) Enum() *Enum { |
| 35 |
p := new(Enum) |
| 36 |
*p = x |
| 37 |
return p |
| 38 |
} |
| 39 |
|
| 40 |
func (x Enum) String() string { |
| 41 |
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) |
| 42 |
} |
| 43 |
|
| 44 |
func (Enum) Descriptor() protoreflect.EnumDescriptor { |
| 45 |
return file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_enumTypes[0].Descriptor() |
| 46 |
} |
| 47 |
|
| 48 |
func (Enum) Type() protoreflect.EnumType { |
| 49 |
return &file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_enumTypes[0] |
| 50 |
} |
| 51 |
|
| 52 |
func (x Enum) Number() protoreflect.EnumNumber { |
| 53 |
return protoreflect.EnumNumber(x) |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
func (x *Enum) UnmarshalJSON(b []byte) error { |
| 58 |
num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) |
| 59 |
if err != nil { |
| 60 |
return err |
| 61 |
} |
| 62 |
*x = Enum(num) |
| 63 |
return nil |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
func (Enum) EnumDescriptor() ([]byte, []int) { |
| 68 |
return file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_rawDescGZIP(), []int{0} |
| 69 |
} |
| 70 |
|
| 71 |
type Message struct { |
| 72 |
state protoimpl.MessageState `protogen:"open.v1"` |
| 73 |
StringField *string `protobuf:"bytes,1,opt,name=string_field,json=stringField" json:"string_field,omitempty"` |
| 74 |
EnumField *Enum `protobuf:"varint,2,opt,name=enum_field,json=enumField,enum=Enum,def=0" json:"enum_field,omitempty"` |
| 75 |
unknownFields protoimpl.UnknownFields |
| 76 |
sizeCache protoimpl.SizeCache |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
const ( |
| 81 |
Default_Message_EnumField = Enum_ZERO |
| 82 |
) |
| 83 |
|
| 84 |
func (x *Message) Reset() { |
| 85 |
*x = Message{} |
| 86 |
mi := &file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_msgTypes[0] |
| 87 |
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| 88 |
ms.StoreMessageInfo(mi) |
| 89 |
} |
| 90 |
|
| 91 |
func (x *Message) String() string { |
| 92 |
return protoimpl.X.MessageStringOf(x) |
| 93 |
} |
| 94 |
|
| 95 |
func (*Message) ProtoMessage() {} |
| 96 |
|
| 97 |
func (x *Message) ProtoReflect() protoreflect.Message { |
| 98 |
mi := &file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_msgTypes[0] |
| 99 |
if x != nil { |
| 100 |
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| 101 |
if ms.LoadMessageInfo() == nil { |
| 102 |
ms.StoreMessageInfo(mi) |
| 103 |
} |
| 104 |
return ms |
| 105 |
} |
| 106 |
return mi.MessageOf(x) |
| 107 |
} |
| 108 |
|
| 109 |
|
| 110 |
func (*Message) Descriptor() ([]byte, []int) { |
| 111 |
return file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_rawDescGZIP(), []int{0} |
| 112 |
} |
| 113 |
|
| 114 |
func (x *Message) GetStringField() string { |
| 115 |
if x != nil && x.StringField != nil { |
| 116 |
return *x.StringField |
| 117 |
} |
| 118 |
return "" |
| 119 |
} |
| 120 |
|
| 121 |
func (x *Message) GetEnumField() Enum { |
| 122 |
if x != nil && x.EnumField != nil { |
| 123 |
return *x.EnumField |
| 124 |
} |
| 125 |
return Default_Message_EnumField |
| 126 |
} |
| 127 |
|
| 128 |
var File_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto protoreflect.FileDescriptor |
| 129 |
|
| 130 |
const file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_rawDesc = "" + |
| 131 |
"\n" + |
| 132 |
"4cmd/protoc-gen-go/testdata/nopackage/nopackage.proto\"X\n" + |
| 133 |
"\aMessage\x12!\n" + |
| 134 |
"\fstring_field\x18\x01 \x01(\tR\vstringField\x12*\n" + |
| 135 |
"\n" + |
| 136 |
"enum_field\x18\x02 \x01(\x0e2\x05.Enum:\x04ZEROR\tenumField*\x10\n" + |
| 137 |
"\x04Enum\x12\b\n" + |
| 138 |
"\x04ZERO\x10\x00" |
| 139 |
|
| 140 |
var ( |
| 141 |
file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_rawDescOnce sync.Once |
| 142 |
file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_rawDescData []byte |
| 143 |
) |
| 144 |
|
| 145 |
func file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_rawDescGZIP() []byte { |
| 146 |
file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_rawDescOnce.Do(func() { |
| 147 |
file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_rawDesc), len(file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_rawDesc))) |
| 148 |
}) |
| 149 |
return file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_rawDescData |
| 150 |
} |
| 151 |
|
| 152 |
var file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_enumTypes = make([]protoimpl.EnumInfo, 1) |
| 153 |
var file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_msgTypes = make([]protoimpl.MessageInfo, 1) |
| 154 |
var file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_goTypes = []any{ |
| 155 |
(Enum)(0), |
| 156 |
(*Message)(nil), |
| 157 |
} |
| 158 |
var file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_depIdxs = []int32{ |
| 159 |
0, |
| 160 |
1, |
| 161 |
1, |
| 162 |
1, |
| 163 |
1, |
| 164 |
0, |
| 165 |
} |
| 166 |
|
| 167 |
func init() { file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_init() } |
| 168 |
func file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_init() { |
| 169 |
if File_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto != nil { |
| 170 |
return |
| 171 |
} |
| 172 |
type x struct{} |
| 173 |
out := protoimpl.TypeBuilder{ |
| 174 |
File: protoimpl.DescBuilder{ |
| 175 |
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), |
| 176 |
RawDescriptor: unsafe.Slice(unsafe.StringData(file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_rawDesc), len(file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_rawDesc)), |
| 177 |
NumEnums: 1, |
| 178 |
NumMessages: 1, |
| 179 |
NumExtensions: 0, |
| 180 |
NumServices: 0, |
| 181 |
}, |
| 182 |
GoTypes: file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_goTypes, |
| 183 |
DependencyIndexes: file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_depIdxs, |
| 184 |
EnumInfos: file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_enumTypes, |
| 185 |
MessageInfos: file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_msgTypes, |
| 186 |
}.Build() |
| 187 |
File_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto = out.File |
| 188 |
file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_goTypes = nil |
| 189 |
file_cmd_protoc_gen_go_testdata_nopackage_nopackage_proto_depIdxs = nil |
| 190 |
} |