Remove runtime.Typer, reduce to ObjectKinds(1) (3)

Remove the unnecessary variants, which avoids allocations in several
core paths.
This commit is contained in:
Clayton Coleman
2016-05-21 00:15:31 -04:00
parent a24936355e
commit c6961d6fd6
38 changed files with 159 additions and 210 deletions

View File

@@ -152,10 +152,11 @@ func (t *Tester) TestWatch(valid runtime.Object, labelsPass, labelsFail []labels
// =============================================================================
// get codec based on runtime.Object
func getCodec(obj runtime.Object) (runtime.Codec, error) {
fqKind, err := api.Scheme.ObjectKind(obj)
fqKinds, _, err := api.Scheme.ObjectKinds(obj)
if err != nil {
return nil, fmt.Errorf("unexpected encoding error: %v", err)
}
fqKind := fqKinds[0]
// TODO: caesarxuchao: we should detect which group an object belongs to
// by using the version returned by Schem.ObjectVersionAndKind() once we
// split the schemes for internal objects.