From 07332ad39852278976438d095ee429431482498c Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Mon, 12 Jul 2021 19:14:30 -0400 Subject: [PATCH] fix ineffassign and varcheck Signed-off-by: Davanum Srinivas --- cmd/kube-proxy/app/server.go | 2 +- pkg/apis/storage/validation/validation_test.go | 4 ++-- pkg/generated/openapi/cmd/models-schema/main.go | 2 +- test/e2e/common/node/pods.go | 5 ----- test/e2e/lifecycle/bootstrap/bootstrap_signer.go | 1 + test/e2e/node/events.go | 1 + test/e2e/node/pods.go | 4 ---- test/e2e/scheduling/limit_range.go | 5 ----- test/integration/evictions/evictions_test.go | 4 ++-- 9 files changed, 8 insertions(+), 20 deletions(-) diff --git a/cmd/kube-proxy/app/server.go b/cmd/kube-proxy/app/server.go index 9d0afad016f..223378762af 100644 --- a/cmd/kube-proxy/app/server.go +++ b/cmd/kube-proxy/app/server.go @@ -90,7 +90,7 @@ const ( proxyModeUserspace = "userspace" proxyModeIPTables = "iptables" proxyModeIPVS = "ipvs" - proxyModeKernelspace = "kernelspace" //nolint:deadcode + proxyModeKernelspace = "kernelspace" //nolint:deadcode,varcheck ) // proxyRun defines the interface to run a specified ProxyServer diff --git a/pkg/apis/storage/validation/validation_test.go b/pkg/apis/storage/validation/validation_test.go index a429b2d8221..fffe8396d46 100644 --- a/pkg/apis/storage/validation/validation_test.go +++ b/pkg/apis/storage/validation/validation_test.go @@ -1696,7 +1696,7 @@ func TestCSIDriverValidation(t *testing.T) { storageCapacity := true notStorageCapacity := false supportedFSGroupPolicy := storage.FileFSGroupPolicy - invalidFSGroupPolicy := storage.ReadWriteOnceWithFSTypeFSGroupPolicy + invalidFSGroupPolicy := storage.ReadWriteOnceWithFSTypeFSGroupPolicy //nolint:ineffassign invalidFSGroupPolicy = "invalid-mode" successCases := []storage.CSIDriver{ { @@ -2051,7 +2051,7 @@ func TestCSIDriverValidationUpdate(t *testing.T) { { name: "FSGroupPolicy invalidated", modify: func(new *storage.CSIDriver) { - invalidFSGroupPolicy := storage.ReadWriteOnceWithFSTypeFSGroupPolicy + invalidFSGroupPolicy := storage.ReadWriteOnceWithFSTypeFSGroupPolicy //nolint:ineffassign invalidFSGroupPolicy = "invalid" new.Spec.FSGroupPolicy = &invalidFSGroupPolicy }, diff --git a/pkg/generated/openapi/cmd/models-schema/main.go b/pkg/generated/openapi/cmd/models-schema/main.go index 818c9b14225..5a348570b5e 100644 --- a/pkg/generated/openapi/cmd/models-schema/main.go +++ b/pkg/generated/openapi/cmd/models-schema/main.go @@ -59,7 +59,7 @@ func output() error { if err != nil { return fmt.Errorf("error serializing api definitions: %w", err) } - _, err = os.Stdout.Write(data) + _, _ = os.Stdout.Write(data) return nil } diff --git a/test/e2e/common/node/pods.go b/test/e2e/common/node/pods.go index 8fd6689fe09..dfd314181ab 100644 --- a/test/e2e/common/node/pods.go +++ b/test/e2e/common/node/pods.go @@ -244,11 +244,6 @@ var _ = SIGDescribe("Pods", func() { pods, err := podClient.List(context.TODO(), options) framework.ExpectNoError(err, "failed to query for pods") framework.ExpectEqual(len(pods.Items), 0) - options = metav1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: pods.ListMeta.ResourceVersion, - } - listCompleted := make(chan bool, 1) lw := &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { diff --git a/test/e2e/lifecycle/bootstrap/bootstrap_signer.go b/test/e2e/lifecycle/bootstrap/bootstrap_signer.go index d44e6ca6425..6a8276af378 100644 --- a/test/e2e/lifecycle/bootstrap/bootstrap_signer.go +++ b/test/e2e/lifecycle/bootstrap/bootstrap_signer.go @@ -78,6 +78,7 @@ var _ = lifecycle.SIGDescribe("[Feature:BootstrapTokens]", func() { ginkgo.By("wait for the bootstrap token secret be signed") err = WaitforSignedClusterInfoByBootStrapToken(c, tokenID) + framework.ExpectNoError(err) cfgMap, err := f.ClientSet.CoreV1().ConfigMaps(metav1.NamespacePublic).Get(context.TODO(), bootstrapapi.ConfigMapClusterInfo, metav1.GetOptions{}) framework.ExpectNoError(err) diff --git a/test/e2e/node/events.go b/test/e2e/node/events.go index c7cd14af6fb..1253d60a83f 100644 --- a/test/e2e/node/events.go +++ b/test/e2e/node/events.go @@ -83,6 +83,7 @@ var _ = SIGDescribe("Events", func() { selector := labels.SelectorFromSet(labels.Set(map[string]string{"time": value})) options := metav1.ListOptions{LabelSelector: selector.String()} pods, err := podClient.List(context.TODO(), options) + framework.ExpectNoError(err) framework.ExpectEqual(len(pods.Items), 1) ginkgo.By("retrieving the pod") diff --git a/test/e2e/node/pods.go b/test/e2e/node/pods.go index 345eb2c76d3..864a1248468 100644 --- a/test/e2e/node/pods.go +++ b/test/e2e/node/pods.go @@ -78,10 +78,6 @@ var _ = SIGDescribe("Pods Extended", func() { pods, err := podClient.List(context.TODO(), options) framework.ExpectNoError(err, "failed to query for pod") framework.ExpectEqual(len(pods.Items), 0) - options = metav1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: pods.ListMeta.ResourceVersion, - } ginkgo.By("submitting the pod to kubernetes") podClient.Create(pod) diff --git a/test/e2e/scheduling/limit_range.go b/test/e2e/scheduling/limit_range.go index 6beeb5565ec..5d84296f568 100644 --- a/test/e2e/scheduling/limit_range.go +++ b/test/e2e/scheduling/limit_range.go @@ -72,11 +72,6 @@ var _ = SIGDescribe("LimitRange", func() { limitRanges, err := f.ClientSet.CoreV1().LimitRanges(f.Namespace.Name).List(context.TODO(), options) framework.ExpectNoError(err, "failed to query for limitRanges") framework.ExpectEqual(len(limitRanges.Items), 0) - options = metav1.ListOptions{ - LabelSelector: selector.String(), - ResourceVersion: limitRanges.ListMeta.ResourceVersion, - } - listCompleted := make(chan bool, 1) lw := &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { diff --git a/test/integration/evictions/evictions_test.go b/test/integration/evictions/evictions_test.go index 1d4be1b44a3..491712a4df0 100644 --- a/test/integration/evictions/evictions_test.go +++ b/test/integration/evictions/evictions_test.go @@ -61,7 +61,7 @@ const ( func TestConcurrentEvictionRequests(t *testing.T) { podNameFormat := "test-pod-%d" - s, closeFn, rm, informers, clientSet := rmSetup(t) + s, closeFn, rm, informers, _ := rmSetup(t) defer closeFn() ns := framework.CreateTestingNamespace("concurrent-eviction-requests", s, t) @@ -180,7 +180,7 @@ func TestConcurrentEvictionRequests(t *testing.T) { // TestTerminalPodEviction ensures that PDB is not checked for terminal pods. func TestTerminalPodEviction(t *testing.T) { - s, closeFn, rm, informers, clientSet := rmSetup(t) + s, closeFn, rm, informers, _ := rmSetup(t) defer closeFn() ns := framework.CreateTestingNamespace("terminalpod-eviction", s, t)