mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Change ObjectKind signature to avoid allocations
We don't need to pass a pointer into SetGroupKindVersion() - a struct works just as well.
This commit is contained in:
@@ -34,12 +34,12 @@ import (
|
||||
)
|
||||
|
||||
type testObject struct {
|
||||
gvk *unversioned.GroupVersionKind
|
||||
gvk unversioned.GroupVersionKind
|
||||
}
|
||||
|
||||
func (d *testObject) GetObjectKind() unversioned.ObjectKind { return d }
|
||||
func (d *testObject) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { d.gvk = gvk }
|
||||
func (d *testObject) GroupVersionKind() *unversioned.GroupVersionKind { return d.gvk }
|
||||
func (d *testObject) GetObjectKind() unversioned.ObjectKind { return d }
|
||||
func (d *testObject) SetGroupVersionKind(gvk unversioned.GroupVersionKind) { d.gvk = gvk }
|
||||
func (d *testObject) GroupVersionKind() unversioned.GroupVersionKind { return d.gvk }
|
||||
|
||||
type testMarshalable struct {
|
||||
testObject
|
||||
@@ -106,7 +106,7 @@ func TestEncode(t *testing.T) {
|
||||
0x22, 0x00, // content-encoding
|
||||
}
|
||||
obj2 := &testMarshalable{
|
||||
testObject: testObject{gvk: &unversioned.GroupVersionKind{Kind: "test", Group: "other", Version: "version"}},
|
||||
testObject: testObject{gvk: unversioned.GroupVersionKind{Kind: "test", Group: "other", Version: "version"}},
|
||||
data: []byte{0x01, 0x02, 0x03},
|
||||
}
|
||||
wire2 := []byte{
|
||||
|
||||
Reference in New Issue
Block a user