PartialObjectMetadataList should nest values, not pointers for Items

Typo during setting up PartialObjectMetadataList, it should be a slice of `PartialObjectMetadata`, not a slice of `*PartialObjectMetadata`.
parent 3d12466c
...@@ -123,7 +123,7 @@ func Test_convertor_ConvertToTable(t *testing.T) { ...@@ -123,7 +123,7 @@ func Test_convertor_ConvertToTable(t *testing.T) {
}, },
args: args{ args: args{
obj: &metav1beta1.PartialObjectMetadataList{ obj: &metav1beta1.PartialObjectMetadataList{
Items: []*metav1beta1.PartialObjectMetadata{ Items: []metav1beta1.PartialObjectMetadata{
{ObjectMeta: metav1.ObjectMeta{Name: "blah", CreationTimestamp: metav1.NewTime(time.Unix(1, 0))}}, {ObjectMeta: metav1.ObjectMeta{Name: "blah", CreationTimestamp: metav1.NewTime(time.Unix(1, 0))}},
{ObjectMeta: metav1.ObjectMeta{Name: "blah-2", CreationTimestamp: metav1.NewTime(time.Unix(2, 0))}}, {ObjectMeta: metav1.ObjectMeta{Name: "blah-2", CreationTimestamp: metav1.NewTime(time.Unix(2, 0))}},
}, },
......
...@@ -1309,5 +1309,5 @@ type PartialObjectMetadataList struct { ...@@ -1309,5 +1309,5 @@ type PartialObjectMetadataList struct {
ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// items contains each of the included items. // items contains each of the included items.
Items []*PartialObjectMetadata `json:"items" protobuf:"bytes,2,rep,name=items"` Items []PartialObjectMetadata `json:"items" protobuf:"bytes,2,rep,name=items"`
} }
...@@ -805,13 +805,9 @@ func (in *PartialObjectMetadataList) DeepCopyInto(out *PartialObjectMetadataList ...@@ -805,13 +805,9 @@ func (in *PartialObjectMetadataList) DeepCopyInto(out *PartialObjectMetadataList
out.ListMeta = in.ListMeta out.ListMeta = in.ListMeta
if in.Items != nil { if in.Items != nil {
in, out := &in.Items, &out.Items in, out := &in.Items, &out.Items
*out = make([]*PartialObjectMetadata, len(*in)) *out = make([]PartialObjectMetadata, len(*in))
for i := range *in { for i := range *in {
if (*in)[i] != nil { (*in)[i].DeepCopyInto(&(*out)[i])
in, out := &(*in)[i], &(*out)[i]
*out = new(PartialObjectMetadata)
(*in).DeepCopyInto(*out)
}
} }
} }
return return
......
...@@ -138,7 +138,7 @@ func (this *PartialObjectMetadataList) String() string { ...@@ -138,7 +138,7 @@ func (this *PartialObjectMetadataList) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&PartialObjectMetadataList{`, s := strings.Join([]string{`&PartialObjectMetadataList{`,
`Items:` + strings.Replace(fmt.Sprintf("%v", this.Items), "PartialObjectMetadata", "k8s_io_apimachinery_pkg_apis_meta_v1.PartialObjectMetadata", 1) + `,`, `Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "PartialObjectMetadata", "k8s_io_apimachinery_pkg_apis_meta_v1.PartialObjectMetadata", 1), `&`, ``, 1) + `,`,
`ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ListMeta", 1), `&`, ``, 1) + `,`, `ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ListMeta", 1), `&`, ``, 1) + `,`,
`}`, `}`,
}, "") }, "")
...@@ -207,7 +207,7 @@ func (m *PartialObjectMetadataList) Unmarshal(dAtA []byte) error { ...@@ -207,7 +207,7 @@ func (m *PartialObjectMetadataList) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.Items = append(m.Items, &k8s_io_apimachinery_pkg_apis_meta_v1.PartialObjectMetadata{}) m.Items = append(m.Items, k8s_io_apimachinery_pkg_apis_meta_v1.PartialObjectMetadata{})
if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err
} }
...@@ -374,25 +374,25 @@ func init() { ...@@ -374,25 +374,25 @@ func init() {
var fileDescriptorGenerated = []byte{ var fileDescriptorGenerated = []byte{
// 322 bytes of a gzipped FileDescriptorProto // 322 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xb1, 0x4e, 0xeb, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x41, 0x4b, 0xf3, 0x30,
0x14, 0x86, 0xe3, 0x7b, 0x55, 0x51, 0xd2, 0x05, 0x75, 0x2a, 0x1d, 0xdc, 0x8a, 0xa9, 0x0c, 0xb5, 0x18, 0xc7, 0x9b, 0xf7, 0x65, 0x38, 0x3a, 0x04, 0xd9, 0x69, 0xee, 0x90, 0x0d, 0x4f, 0xf3, 0xb0,
0xd5, 0x0a, 0x21, 0x24, 0xb6, 0x6e, 0x48, 0x20, 0x50, 0x47, 0xd4, 0xc5, 0x49, 0x0f, 0xa9, 0x09, 0x84, 0x0d, 0x11, 0xc1, 0xdb, 0x6e, 0x82, 0xa2, 0xec, 0x28, 0x1e, 0x4c, 0xbb, 0xc7, 0x2e, 0xd6,
0x8e, 0x23, 0xfb, 0xa4, 0x12, 0x1b, 0x8f, 0xc0, 0x63, 0x75, 0xec, 0x46, 0xa7, 0x8a, 0x9a, 0x17, 0x34, 0x25, 0x79, 0x3a, 0xf0, 0xe6, 0x47, 0xf0, 0x63, 0xed, 0xb8, 0xe3, 0x40, 0x18, 0xae, 0x7e,
0x41, 0x49, 0x03, 0x42, 0x05, 0x44, 0xb6, 0x9c, 0xff, 0xe8, 0xfb, 0xf2, 0xdb, 0xf6, 0xc7, 0xf1, 0x11, 0x49, 0x57, 0x45, 0xa6, 0x62, 0x6f, 0x7d, 0xfe, 0xcd, 0xef, 0x97, 0x7f, 0x12, 0x7f, 0x1c,
0x99, 0x65, 0x52, 0xf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xda, 0x26, 0xae, 0x9f, 0x73, 0x8f, 0xf6, 0x4a, 0x6f, 0xfd, 0x23,
0x64, 0xfc, 0x69, 0x1c, 0xf5, 0x17, 0x1b, 0xea, 0x2d, 0x37, 0xd4, 0x5b, 0x6d, 0xa8, 0xf7, 0xe4, 0x19, 0x7f, 0x1a, 0x47, 0xfd, 0xf9, 0x9a, 0x7a, 0x8b, 0x35, 0xf5, 0x96, 0x6b, 0xea, 0x3d, 0xe5,
0x28, 0x59, 0x38, 0x4a, 0x96, 0x8e, 0x92, 0x95, 0xa3, 0xe4, 0xd5, 0x51, 0xf2, 0xfc, 0x46, 0xbd, 0x94, 0xcc, 0x73, 0x4a, 0x16, 0x39, 0x25, 0xcb, 0x9c, 0x92, 0xd7, 0x9c, 0x92, 0xe7, 0x37, 0xea,
0xdb, 0xbd, 0xf2, 0x59, 0xdf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xce, 0xfa, 0x86, 0x29, 0x56, 0x02, 0x5d, 0xef, 0x94, 0x4f, 0xfb, 0x1e, 0x00, 0x00, 0xff, 0xff, 0x10, 0x2f, 0x48, 0xbd, 0x5a, 0x02,
0x00, 0x00, 0x00, 0x00,
} }
...@@ -68,7 +68,7 @@ type PartialObjectMetadataList struct { ...@@ -68,7 +68,7 @@ type PartialObjectMetadataList struct {
v1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,2,opt,name=metadata"` v1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,2,opt,name=metadata"`
// items contains each of the included items. // items contains each of the included items.
Items []*v1.PartialObjectMetadata `json:"items" protobuf:"bytes,1,rep,name=items"` Items []v1.PartialObjectMetadata `json:"items" protobuf:"bytes,1,rep,name=items"`
} }
const ( const (
......
...@@ -32,13 +32,9 @@ func (in *PartialObjectMetadataList) DeepCopyInto(out *PartialObjectMetadataList ...@@ -32,13 +32,9 @@ func (in *PartialObjectMetadataList) DeepCopyInto(out *PartialObjectMetadataList
out.ListMeta = in.ListMeta out.ListMeta = in.ListMeta
if in.Items != nil { if in.Items != nil {
in, out := &in.Items, &out.Items in, out := &in.Items, &out.Items
*out = make([]*v1.PartialObjectMetadata, len(*in)) *out = make([]v1.PartialObjectMetadata, len(*in))
for i := range *in { for i := range *in {
if (*in)[i] != nil { (*in)[i].DeepCopyInto(&(*out)[i])
in, out := &(*in)[i], &(*out)[i]
*out = new(v1.PartialObjectMetadata)
(*in).DeepCopyInto(*out)
}
} }
} }
return return
......
...@@ -2378,7 +2378,7 @@ func TestGetPartialObjectMetadata(t *testing.T) { ...@@ -2378,7 +2378,7 @@ func TestGetPartialObjectMetadata(t *testing.T) {
ResourceVersion: "10", ResourceVersion: "10",
SelfLink: "/test/link", SelfLink: "/test/link",
}, },
Items: []*metav1beta1.PartialObjectMetadata{ Items: []metav1beta1.PartialObjectMetadata{
{ {
TypeMeta: metav1.TypeMeta{APIVersion: "meta.k8s.io/v1beta1", Kind: "PartialObjectMetadata"}, TypeMeta: metav1.TypeMeta{APIVersion: "meta.k8s.io/v1beta1", Kind: "PartialObjectMetadata"},
ObjectMeta: metav1.ObjectMeta{Name: "foo1", Namespace: "ns1", CreationTimestamp: now, UID: types.UID("newer")}, ObjectMeta: metav1.ObjectMeta{Name: "foo1", Namespace: "ns1", CreationTimestamp: now, UID: types.UID("newer")},
......
...@@ -220,7 +220,7 @@ func asPartialObjectMetadataList(result runtime.Object, groupVersion schema.Grou ...@@ -220,7 +220,7 @@ func asPartialObjectMetadataList(result runtime.Object, groupVersion schema.Grou
} }
partial := meta.AsPartialObjectMetadata(m) partial := meta.AsPartialObjectMetadata(m)
partial.GetObjectKind().SetGroupVersionKind(gvk) partial.GetObjectKind().SetGroupVersionKind(gvk)
list.Items = append(list.Items, partial) list.Items = append(list.Items, *partial)
return nil return nil
}) })
if err != nil { if err != nil {
...@@ -240,7 +240,7 @@ func asPartialObjectMetadataList(result runtime.Object, groupVersion schema.Grou ...@@ -240,7 +240,7 @@ func asPartialObjectMetadataList(result runtime.Object, groupVersion schema.Grou
} }
partial := meta.AsPartialObjectMetadata(m) partial := meta.AsPartialObjectMetadata(m)
partial.GetObjectKind().SetGroupVersionKind(gvk) partial.GetObjectKind().SetGroupVersionKind(gvk)
list.Items = append(list.Items, partial) list.Items = append(list.Items, *partial)
return nil return nil
}) })
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment