Remove runtime.Typer, reduce to ObjectKinds(1) (3)
Remove the unnecessary variants, which avoids allocations in several core paths.
This commit is contained in:
@@ -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.
|
||||
|
Reference in New Issue
Block a user