@@ -95,8 +95,7 @@ func (uc *unstructuredClient) Update(ctx context.Context, obj Object, opts ...Up
9595
9696// Delete implements client.Client.
9797func (uc * unstructuredClient ) Delete (ctx context.Context , obj Object , opts ... DeleteOption ) error {
98- _ , ok := obj .(* unstructured.Unstructured )
99- if ! ok {
98+ if _ , ok := obj .(* unstructured.Unstructured ); ! ok {
10099 return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
101100 }
102101
@@ -118,8 +117,7 @@ func (uc *unstructuredClient) Delete(ctx context.Context, obj Object, opts ...De
118117
119118// DeleteAllOf implements client.Client.
120119func (uc * unstructuredClient ) DeleteAllOf (ctx context.Context , obj Object , opts ... DeleteAllOfOption ) error {
121- _ , ok := obj .(* unstructured.Unstructured )
122- if ! ok {
120+ if _ , ok := obj .(* unstructured.Unstructured ); ! ok {
123121 return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
124122 }
125123
@@ -141,8 +139,7 @@ func (uc *unstructuredClient) DeleteAllOf(ctx context.Context, obj Object, opts
141139
142140// Patch implements client.Client.
143141func (uc * unstructuredClient ) Patch (ctx context.Context , obj Object , patch Patch , opts ... PatchOption ) error {
144- _ , ok := obj .(* unstructured.Unstructured )
145- if ! ok {
142+ if _ , ok := obj .(* unstructured.Unstructured ); ! ok {
146143 return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
147144 }
148145
@@ -201,9 +198,7 @@ func (uc *unstructuredClient) List(ctx context.Context, obj ObjectList, opts ...
201198 }
202199
203200 gvk := u .GroupVersionKind ()
204- if strings .HasSuffix (gvk .Kind , "List" ) {
205- gvk .Kind = gvk .Kind [:len (gvk .Kind )- 4 ]
206- }
201+ gvk .Kind = strings .TrimSuffix (gvk .Kind , "List" )
207202
208203 listOpts := ListOptions {}
209204 listOpts .ApplyOptions (opts )
@@ -222,8 +217,7 @@ func (uc *unstructuredClient) List(ctx context.Context, obj ObjectList, opts ...
222217}
223218
224219func (uc * unstructuredClient ) UpdateStatus (ctx context.Context , obj Object , opts ... UpdateOption ) error {
225- _ , ok := obj .(* unstructured.Unstructured )
226- if ! ok {
220+ if _ , ok := obj .(* unstructured.Unstructured ); ! ok {
227221 return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
228222 }
229223
0 commit comments