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:
Clayton Coleman
2016-04-30 20:34:40 -04:00
parent bffbc112f0
commit a84e62d9e6
22 changed files with 109 additions and 143 deletions

View File

@@ -30,12 +30,12 @@ import (
type testDecodable struct {
Other string
Value int `json:"value"`
gvk *unversioned.GroupVersionKind
gvk unversioned.GroupVersionKind
}
func (d *testDecodable) GetObjectKind() unversioned.ObjectKind { return d }
func (d *testDecodable) SetGroupVersionKind(gvk *unversioned.GroupVersionKind) { d.gvk = gvk }
func (d *testDecodable) GroupVersionKind() *unversioned.GroupVersionKind { return d.gvk }
func (d *testDecodable) GetObjectKind() unversioned.ObjectKind { return d }
func (d *testDecodable) SetGroupVersionKind(gvk unversioned.GroupVersionKind) { d.gvk = gvk }
func (d *testDecodable) GroupVersionKind() unversioned.GroupVersionKind { return d.gvk }
func TestDecode(t *testing.T) {
gvk1 := &unversioned.GroupVersionKind{Kind: "Test", Group: "other", Version: "blah"}