Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't work with unexported fields in protobuf #10

Open
Kybxd opened this issue Sep 9, 2022 · 1 comment
Open

Can't work with unexported fields in protobuf #10

Kybxd opened this issue Sep 9, 2022 · 1 comment

Comments

@Kybxd
Copy link

Kybxd commented Sep 9, 2022

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)}
@medbrh
Copy link

medbrh commented Nov 7, 2022

Hi @Kybxd, I am facing the exact same issue
did you solve it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants