@@ -95,8 +95,7 @@ func (uc *unstructuredClient) Update(ctx context.Context, obj Object, opts ...Up
95
95
96
96
// Delete implements client.Client.
97
97
func (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 {
100
99
return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
101
100
}
102
101
@@ -118,8 +117,7 @@ func (uc *unstructuredClient) Delete(ctx context.Context, obj Object, opts ...De
118
117
119
118
// DeleteAllOf implements client.Client.
120
119
func (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 {
123
121
return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
124
122
}
125
123
@@ -141,8 +139,7 @@ func (uc *unstructuredClient) DeleteAllOf(ctx context.Context, obj Object, opts
141
139
142
140
// Patch implements client.Client.
143
141
func (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 {
146
143
return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
147
144
}
148
145
@@ -201,9 +198,7 @@ func (uc *unstructuredClient) List(ctx context.Context, obj ObjectList, opts ...
201
198
}
202
199
203
200
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" )
207
202
208
203
listOpts := ListOptions {}
209
204
listOpts .ApplyOptions (opts )
@@ -222,8 +217,7 @@ func (uc *unstructuredClient) List(ctx context.Context, obj ObjectList, opts ...
222
217
}
223
218
224
219
func (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 {
227
221
return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
228
222
}
229
223
0 commit comments