Consider the following message:
message Moo {
uint64 generation = 1;
string title = 2;
bytes payload = 3;
repeated string flags = 4;
}
In addition to the type Moo struct that protoc generates, which contains extra fields (state, sizeCache, unknownFields in the code I just generated), I also need to generate a type without the extra fields, something like
type MooLight struct {
Generation uint64
Title string
Payload []byte
Flags []string
}
(whether the tags are there make no difference to me, I've omitted them here for clarity).
I know I can always write some code that takes the generated moo.pb.go file, and starting with var File_moo_proto protoreflect.FileDescriptor generate the "light" structs, but it would be better to let the protocol compiler do it. Any suggestions or advice? I tried looking at the go protoc plugin, and it's a tremendous amount of code.