migrating from gogo/protobuf to google protobuf implemenation

Skip to first unread message

vaibhav mittal

Sep 27, 2022, 4:19:09 PM9/27/22
to Protocol Buffers
Hi Joe and others

We are migrating our code base from gogo/protobuf to second version of google.golang.org/protobuf.
We are running into several issues because the new structs have some internal fields namely:- 
    state         protoimpl.MessageState
    sizeCache     protoimpl.SizeCache
    unknownFields protoimpl.UnknownFields

As a result of these proto.equal doesnt work anymore on these structs and we cannot compare maps  and slices.
More importantly we cannot pass these structures as value since it complains with below error:- 
 copies lock value: waf_rules.GlobalSpecType contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex

Are you aware of any option to disable generating these internal fields for the structs or can we change the protoc to not generate these?
Any help would be appreciated. Thanks
Reply all
Reply to author
0 new messages