protobuf
protobuf copied to clipboard
After compiling proto files, running into "no field or method MarshalToSizedBuffer"
I can compile the proto files but after trying to import them, I get a bunch of errors like this. I've cleaned my go cache between instances of compilation and other users in my org have run into the same issue. It seems to have started recently as well.
m.ListMeta.MarshalToSizedBuffer undefined (type *"k8s.io/apimachinery/pkg/apis/meta/v1".ListMeta has no field or method MarshalToSizedBuffer)
@apelisse Hi. I am not well versed with the kubernetes api. Do you have any recommendation why ListMeta
would not have the MarshalToSizedBuffer
method?
It's very very hard to say since I have no idea what @ntalcus is trying to do or how they do it.
@ntalcus what are you trying to build (k8s.io/kubernetes
or a project of your own that depends on k8s.io/{apimachinery/client-go/etc}
)? it sounds like you're using the master version of some of the k8s.io/*
repos, but possibly not all of them? The output of the following in your build tree might help diagnose what's going on:
GO111MODULE=on go mod graph | grep k8s.io
Hey all! Just wanted to update this issue since we've figured it out on our end. The issue wasn't specifically with Kubernetes, it was happening with arbitrary protobuf structs that were built e.g. building message_x
would run into issues where message_x.MarshalToSizedBuffer
was undefined. That said, we bumped the golang version of our protobuf repo to be in line with the repos using the generated protobuf structs and fixed the dependencies to a working version which resolved the issue for us. Thanks all.
I am having this issue with my own packages. I have an already existing package A with A.pb.go I recently created B.pb.go which imports A.pb.go B.pb.go tries to use MarshalToSizedBuffer and other new methods from A.pb.go, but A.pb.go doesnt have them A.pb.go was generated months ago but B.pb.go was generated using a newer version of gogo a few days ago
Yes, one has to re-generate all their protobufs with the new version. We clearly should have made it more clear. :-/
I ran into the same issue. Which library's version should be upgraded to fix this?
@jmarais Have you released a specific version with this code yet?
@apelisse @jmarais When can we expect a release with this code? We have some dependencies in our project which points to the unreleased revision of gogo/protobuf which contains this change. But we do not wish to point to this revision since it is not released. Any suggestions to solve this issue?
@apelisse I have not made a new release with this code yet.
I think this issue can be closed? Release v1.3.0 and v1.3.1 includes the MarshalToSizedBuffer functions AFAIK. The fix to this problem is to regenerate all protocol buffers with the newest release of gogo/protobuf. I'm not 100% how to handle the case where you might need to be compatible with older gogo/protobuf releases (maybe you need to import the "old" version for a while)?