What's the byte array in my generated protocol buffer code for?

Viewed 524

When I run protoc with --go_out=. on a .proto file, the generated Go source contains a byte slice literal. For example:

var File_pm_proto protoreflect.FileDescriptor

var file_pm_proto_rawDesc = []byte{
    0x0a, 0x08, 0x70, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x35, 0x0a, 0x07, 0x53, 0x74,
    0x61, 0x72, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
    0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x65, 0x61,
    0x6b, 0x38, 0x35, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x06, 0x70, 0x65, 0x61, 0x6b, 0x38,
    0x35, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x6d, 0x61, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f,
    0x74, 0x6f, 0x33,
}

What is encoded in this byte slice, and how is it used? Does it relate to encoding or decoding the wire format?

0 Answers
Related