allocate
allocate copied to clipboard
Can't work with unexported fields in protobuf
Protobuf now has 3 unexported fields
type MyPbStruct struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
MyInt int32 `protobuf:"varint,1,opt,name=my_int,json=friendRuid,proto3" json:"my_int,omitempty"`
}
When trying to set this struct zero
st := new(MyPbStruct)
err := allocate.Zero(st)
if err != nil{
log.Error(err)
}
I got
struct field can't interface, &impl.MessageState{NoUnkeyedLiterals:pragma.NoUnkeyedLiterals{}, DoNotCompare:pragma.DoNotCompare{}, DoNotCopy:pragma.DoNotCopy{}, atomicMessageInfo:(*impl.MessageInfo)(nil)}
Hi @Kybxd, I am facing the exact same issue did you solve it ?