ericchiang / k8s

A simple Kubernetes Go client
Apache License 2.0
599 stars 108 forks source link

Update protobuf dependency #125

Open gwenaskell opened 4 years ago

gwenaskell commented 4 years ago

Hello,

We have been using the client for the last few months without problem until we had to update protobuf to be able to use the https://github.com/google/go-containerregistry project.

This leads to the following panic upon initialization:

panic: mismatching message name: got k8s.io.kubernetes.pkg.watch.versioned.Event, want github.com/ericchiang.k8s.watch.versioned.Event

goroutine 1 [running]:
google.golang.org/protobuf/internal/impl.legacyLoadMessageDesc(0x55ba9b96e7e0, 0x55ba9b8f6140, 0x55ba9b735203, 0x2f, 0x0, 0x0)
    /vendor/google.golang.org/protobuf/internal/impl/legacy_message.go:136 +0x884
google.golang.org/protobuf/internal/impl.legacyLoadMessageInfo(0x55ba9b96e7e0, 0x55ba9b8f6140, 0x55ba9b735203, 0x2f, 0x55ba9b171219)
    /vendor/google.golang.org/protobuf/internal/impl/legacy_message.go:48 +0xbf
google.golang.org/protobuf/internal/impl.Export.LegacyMessageTypeOf(0x55ba9b963e60, 0x0, 0x55ba9b735203, 0x2f, 0xc00003c9a0, 0xc000109450)
    /vendor/google.golang.org/protobuf/internal/impl/legacy_export.go:33 +0xa7
github.com/golang/protobuf/proto.RegisterType(0x55ba9b963e60, 0x0, 0x55ba9b735203, 0x2f)
    /vendor/github.com/golang/protobuf/proto/registry.go:186 +0x4f
github.com/ericchiang/k8s/watch/versioned.init.0()
    /vendor/github.com/ericchiang/k8s/watch/versioned/generated.pb.go:76 +0x4d

I have tested by changing the expected input as suggested in this thread: https://stackoverflow.com/questions/61251129/how-to-fix-conflicts-with-this-error-message. I haven't observed any bug after this change, but I would not rely on a manual editing of the source code.

Is there any plan to upgrade protobuf to the latest version soon?

Thanks

AlfredBroda commented 4 years ago

Some CI tools (Circle, Travis) seem to be bumping up protobuf version regardless of the version specified in go.mod. This issue is getting really annoying.