Go Protobuf Coder/Encoder Errors

8/20/2017

I am trying to create a .proto file for a Kubernetes custom resource and hence I need to include the ObjectMeta in my file. I am doing it like this:

syntax = "proto2";
package spec;

import "k8s.io/kubernetes/pkg/api/unversioned/generated.proto";
import "k8s.io/kubernetes/pkg/api/v1/generated.proto";

message APIKeyList {
  optional string kind = 1;
  optional string apiVersion = 2;
  optional k8s.io.kubernetes.pkg.api.unversioned.ListMeta metadata = 3;
  repeated APIKey items = 4;
}

Using protoc, it successfully creates my *.pb.go file however when I run my test suite, I receive the following error:

proto: no coders for unversioned.Time
proto: no encoder for CreationTimestamp unversioned.Time [GetProperties]
proto: tag has too few fields: "-"
proto: no coders for time.Time
proto: no encoder for Time time.Time [GetProperties]
proto: no slice oenc for *reflect.rtype = []*reflect.rtype
proto: no encoder for OwnerReferences []v1.OwnerReference [GetProperties]

Now I am not using any time fields and so I assume is has something to do with the imported proto files.

-- frankgreco
go
kubernetes
protocol-buffers

0 Answers