From 53aff819e0edab0f8fd50f19dc583bfaa045d972 Mon Sep 17 00:00:00 2001 From: yiyang5055 Date: Mon, 20 Jan 2020 09:10:46 +0000 Subject: [PATCH] fix static check failure in pkg/controller/disruption and pkg/controller/namespace/deletion --- hack/.staticcheck_failures | 2 -- pkg/controller/disruption/disruption_test.go | 6 ------ .../namespace/deletion/namespaced_resources_deleter.go | 3 +-- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/hack/.staticcheck_failures b/hack/.staticcheck_failures index 38248f165cf..67493cd7e18 100644 --- a/hack/.staticcheck_failures +++ b/hack/.staticcheck_failures @@ -2,9 +2,7 @@ cluster/images/etcd-version-monitor cluster/images/etcd/migrate pkg/controller/daemon pkg/controller/deployment -pkg/controller/disruption pkg/controller/garbagecollector -pkg/controller/namespace/deletion pkg/controller/nodeipam pkg/controller/podautoscaler pkg/controller/podgc diff --git a/pkg/controller/disruption/disruption_test.go b/pkg/controller/disruption/disruption_test.go index 35caca47236..a98787af204 100644 --- a/pkg/controller/disruption/disruption_test.go +++ b/pkg/controller/disruption/disruption_test.go @@ -639,12 +639,9 @@ func TestReplicationController(t *testing.T) { // about the RC. This is a known bug. TODO(mml): file issue ps.VerifyPdbStatus(t, pdbName, 0, 0, 0, 0, map[string]metav1.Time{}) - pods := []*v1.Pod{} - for i := int32(0); i < 3; i++ { pod, _ := newPod(t, fmt.Sprintf("foobar %d", i)) updatePodOwnerToRc(t, pod, rc) - pods = append(pods, pod) pod.Labels = labels add(t, dc.podStore, pod) dc.sync(pdbName) @@ -680,12 +677,9 @@ func TestStatefulSetController(t *testing.T) { // about the SS. This is a known bug. TODO(mml): file issue ps.VerifyPdbStatus(t, pdbName, 0, 0, 0, 0, map[string]metav1.Time{}) - pods := []*v1.Pod{} - for i := int32(0); i < 3; i++ { pod, _ := newPod(t, fmt.Sprintf("foobar %d", i)) updatePodOwnerToSs(t, pod, ss) - pods = append(pods, pod) pod.Labels = labels add(t, dc.podStore, pod) dc.sync(pdbName) diff --git a/pkg/controller/namespace/deletion/namespaced_resources_deleter.go b/pkg/controller/namespace/deletion/namespaced_resources_deleter.go index 255e79b5220..1bbceb5d329 100644 --- a/pkg/controller/namespace/deletion/namespaced_resources_deleter.go +++ b/pkg/controller/namespace/deletion/namespaced_resources_deleter.go @@ -162,7 +162,7 @@ func (d *namespacedResourcesDeleter) initOpCache() { if len(resources) == 0 { klog.Fatalf("Unable to get any supported resources from server: %v", err) } - deletableGroupVersionResources := []schema.GroupVersionResource{} + for _, rl := range resources { gv, err := schema.ParseGroupVersion(rl.GroupVersion) if err != nil { @@ -183,7 +183,6 @@ func (d *namespacedResourcesDeleter) initOpCache() { d.opCache.setNotSupported(operationKey{operation: op, gvr: gvr}) } } - deletableGroupVersionResources = append(deletableGroupVersionResources, gvr) } } }