kubernetes: Some "vectorized" tests never run due to bad closure var capture

What happened: Noticed some tests in this repo never run properly - they only use the last element in the loop repeatedly.

What you expected to happen: The tests should use all elements they iterate on for testing

How to reproduce it (as minimally and precisely as possible): Run the tests, see that they always only use the last element in the loop instead of all of them

Anything else we need to know?: This is caused by a common mistake done when using Ginkgo and defining It blocks inside for loops. The issue is the following line missing (d := d where d is the loop variable), see ginkgo docs example: image

Here are just two examples I stumbled upon with very poor greping, there might be more: https://github.com/kubernetes/kubernetes/blob/a410c14020017c7bedeb4c501758088155c66fb7/test/e2e/storage/ephemeral_volume.go#L54-L55 https://github.com/kubernetes/kubernetes/blob/a410c14020017c7bedeb4c501758088155c66fb7/test/e2e/node/kubelet.go#L432-L434

https://github.com/kyoh86/scopelint is an obsolete linter that detects this issue, not sure why it’s obsolete - might have a lot of false negatives

EDIT: Ran scopelint on the test folder, lots of hits (some may be irrelevant, but sampled some random ones and they seem relevant):

$ scopelint ./...
conformance/walk_test.go:126:32: Using the variable on range scope "tc" in function literal
conformance/walk_test.go:126:45: Using the variable on range scope "tc" in function literal
conformance/walk_test.go:126:54: Using the variable on range scope "tc" in function literal
conformance/walk_test.go:130:30: Using the variable on range scope "tc" in function literal
conformance/walk_test.go:132:6: Using the variable on range scope "tc" in function literal
conformance/walk_test.go:132:19: Using the variable on range scope "tc" in function literal
conformance/walk_test.go:165:36: Using the variable on range scope "tc" in function literal
conformance/walk_test.go:166:31: Using the variable on range scope "tc" in function literal
conformance/walk_test.go:167:42: Using the variable on range scope "tc" in function literal
e2e/apimachinery/custom_resource_definition.go:207:15: Using a reference for the variable on range scope "g"
e2e/apimachinery/custom_resource_definition.go:217:17: Using a reference for the variable on range scope "v"
e2e/apimachinery/custom_resource_definition.go:235:17: Using a reference for the variable on range scope "v"
e2e/apimachinery/etcd_failure.go:141:59: Using a reference for the variable on range scope "pod"
e2e/apimachinery/webhook.go:124:15: Using a reference for the variable on range scope "g"
e2e/apimachinery/webhook.go:134:17: Using a reference for the variable on range scope "v"
e2e/apimachinery/webhook.go:152:17: Using a reference for the variable on range scope "v"
e2e/apps/daemon_restart.go:196:49: Using a reference for the variable on range scope "p"
e2e/apps/daemon_set.go:103:87: Using a reference for the variable on range scope "ds"
e2e/apps/daemon_set.go:626:31: Using a reference for the variable on range scope "pod"
e2e/apps/daemon_set.go:632:31: Using a reference for the variable on range scope "pod"
e2e/apps/daemon_set.go:721:31: Using a reference for the variable on range scope "pod"
e2e/apps/daemon_set.go:730:32: Using a reference for the variable on range scope "pod"
e2e/apps/deployment.go:880:50: Using the variable on range scope "i" in function literal
e2e/apps/deployment.go:880:79: Using the variable on range scope "i" in function literal
e2e/apps/deployment.go:882:25: Using the variable on range scope "i" in function literal
e2e/apps/deployment.go:901:25: Using the variable on range scope "i" in function literal
e2e/apps/deployment.go:911:26: Using the variable on range scope "i" in function literal
e2e/apps/deployment.go:918:26: Using the variable on range scope "i" in function literal
e2e/apps/deployment.go:1158:47: Using a reference for the variable on range scope "rs"
e2e/apps/deployment.go:1170:48: Using a reference for the variable on range scope "rs"
e2e/apps/deployment.go:1274:65: Using the variable on range scope "i" in function literal
e2e/apps/statefulset.go:454:19: Using the variable on range scope "i" in function literal
e2e/autoscaling/cluster_autoscaler_scalability.go:125:35: Using a reference for the variable on range scope "n"
e2e/autoscaling/cluster_size_autoscaling.go:153:35: Using a reference for the variable on range scope "n"
e2e/autoscaling/cluster_size_autoscaling.go:783:46: Using a reference for the variable on range scope "node"
e2e/autoscaling/cluster_size_autoscaling.go:1250:27: Using a reference for the variable on range scope "node"
e2e/autoscaling/cluster_size_autoscaling.go:1657:46: Using a reference for the variable on range scope "node"
e2e/autoscaling/cluster_size_autoscaling.go:1686:43: Using a reference for the variable on range scope "node"
e2e/autoscaling/cluster_size_autoscaling.go:1711:54: Using the variable on range scope "i" in function literal
e2e/autoscaling/cluster_size_autoscaling.go:1719:45: Using a reference for the variable on range scope "node"
e2e/cloud/gcp/kubelet_security.go:69:28: Using the variable on range scope "port" in function literal
e2e/cloud/gcp/reboot.go:322:66: Using a reference for the variable on range scope "n"
e2e/framework/pods.go:243:11: Using a reference for the variable on range scope "e"
e2e/framework/resource_usage_gatherer.go:283:55: Using a reference for the variable on range scope "container"
e2e/framework/util.go:424:51: Using a reference for the variable on range scope "e"
e2e/framework/util.go:1385:50: Using a reference for the variable on range scope "watchEventIndex"
e2e/framework/deployment/fixtures.go:103:30: Using a reference for the variable on range scope "rs"
e2e/framework/deployment/fixtures.go:107:48: Using a reference for the variable on range scope "rs"
e2e/framework/deployment/fixtures.go:155:44: Using a reference for the variable on range scope "pod"
e2e/framework/ingress/ingress_utils.go:472:68: Using a reference for the variable on range scope "svc"
e2e/framework/kubectl/kubectl_utils.go:111:45: Using a reference for the variable on range scope "pod"
e2e/framework/node/resource.go:255:45: Using a reference for the variable on range scope "n"
e2e/framework/node/wait.go:62:34: Using a reference for the variable on range scope "node"
e2e/framework/node/wait.go:81:39: Using a reference for the variable on range scope "node"
e2e/framework/node/wait.go:218:23: Using a reference for the variable on range scope "node"
e2e/framework/node/wait.go:236:39: Using a reference for the variable on range scope "node"
e2e/framework/node/wait.go:237:39: Using a reference for the variable on range scope "node"
e2e/framework/node/wait_test.go:167:37: Using the variable on range scope "tc" in function literal
e2e/framework/node/wait_test.go:168:28: Using the variable on range scope "tc" in function literal
e2e/framework/node/wait_test.go:170:39: Using the variable on range scope "tc" in function literal
e2e/framework/node/wait_test.go:170:61: Using the variable on range scope "tc" in function literal
e2e/framework/node/wait_test.go:172:14: Using the variable on range scope "tc" in function literal
e2e/framework/node/wait_test.go:173:40: Using the variable on range scope "tc" in function literal
e2e/framework/node/wait_test.go:176:27: Using the variable on range scope "tc" in function literal
e2e/framework/node/wait_test.go:177:39: Using the variable on range scope "tc" in function literal
e2e/framework/node/wait_test.go:178:38: Using the variable on range scope "tc" in function literal
e2e/framework/node/wait_test.go:179:46: Using the variable on range scope "tc" in function literal
e2e/framework/node/wait_test.go:260:25: Using the variable on range scope "tc" in function literal
e2e/framework/node/wait_test.go:260:34: Using the variable on range scope "tc" in function literal
e2e/framework/node/wait_test.go:261:14: Using the variable on range scope "tc" in function literal
e2e/framework/node/wait_test.go:262:40: Using the variable on range scope "tc" in function literal
e2e/framework/pod/delete.go:86:42: Using a reference for the variable on range scope "pod"
e2e/framework/pod/resource_test.go:54:40: Using the variable on range scope "tt" in function literal
e2e/framework/pod/resource_test.go:56:23: Using the variable on range scope "tt" in function literal
e2e/framework/pod/resource_test.go:57:50: Using the variable on range scope "tt" in function literal
e2e/framework/pod/resource_test.go:59:31: Using the variable on range scope "tt" in function literal
e2e/framework/pod/resource_test.go:60:35: Using the variable on range scope "tt" in function literal
e2e/framework/pod/wait.go:163:43: Using a reference for the variable on range scope "pod"
e2e/framework/pod/wait.go:176:32: Using a reference for the variable on range scope "pod"
e2e/framework/pod/wait.go:299:28: Using a reference for the variable on range scope "pod"
e2e/framework/pod/wait.go:475:48: Using a reference for the variable on range scope "pod"
e2e/framework/pod/wait.go:498:33: Using a reference for the variable on range scope "pod"
e2e/framework/providers/gce/firewall_test.go:48:28: Using the variable on range scope "c" in function literal
e2e/framework/providers/gce/firewall_test.go:48:40: Using the variable on range scope "c" in function literal
e2e/framework/providers/gce/firewall_test.go:49:7: Using the variable on range scope "c" in function literal
e2e/framework/providers/gce/firewall_test.go:50:60: Using the variable on range scope "c" in function literal
e2e/framework/providers/gce/firewall_test.go:50:72: Using the variable on range scope "c" in function literal
e2e/framework/providers/gce/firewall_test.go:50:92: Using the variable on range scope "c" in function literal
e2e/framework/service/jig.go:276:46: Using a reference for the variable on range scope "node"
e2e/framework/statefulset/fixtures.go:162:27: Using a reference for the variable on range scope "pod"
e2e/framework/statefulset/fixtures.go:162:51: Using a reference for the variable on range scope "pod"
e2e/framework/statefulset/rest.go:163:109: Using a reference for the variable on range scope "statefulPod"
e2e/framework/statefulset/wait.go:47:45: Using a reference for the variable on range scope "p"
e2e/framework/statefulset/wait.go:48:37: Using a reference for the variable on range scope "p"
e2e/instrumentation/logging/elasticsearch/kibana.go:81:59: Using a reference for the variable on range scope "pod"
e2e/instrumentation/logging/elasticsearch/utils.go:84:59: Using a reference for the variable on range scope "pod"
e2e/network/dual_stack.go:62:41: Using a reference for the variable on range scope "node"
e2e/network/dual_stack.go:656:90: Using the variable on range scope "clientPod" in function literal
e2e/network/dual_stack.go:656:106: Using the variable on range scope "ip" in function literal
e2e/network/dual_stack.go:657:37: Using the variable on range scope "ip" in function literal
e2e/network/dual_stack.go:658:57: Using the variable on range scope "clientPod" in function literal
e2e/network/fixture.go:120:90: Using the variable on range scope "rcName" in function literal
e2e/network/ingress.go:268:72: Using a reference for the variable on range scope "svc"
e2e/network/ingress.go:286:72: Using a reference for the variable on range scope "svc"
e2e/network/ingress.go:511:72: Using a reference for the variable on range scope "svc"
e2e/network/ingress.go:522:72: Using a reference for the variable on range scope "svc"
e2e/network/ingress.go:533:72: Using a reference for the variable on range scope "svc"
e2e/network/ingress.go:546:72: Using a reference for the variable on range scope "svc"
e2e/network/ingress.go:1137:22: Using a reference for the variable on range scope "ing"
e2e/network/ingress.go:1150:21: Using a reference for the variable on range scope "ing"
e2e/network/service.go:3237:33: Using a reference for the variable on range scope "node"
e2e/network/service.go:3244:33: Using a reference for the variable on range scope "n"
e2e/network/service.go:3278:6: Using the variable on range scope "nodeIP" in function literal
e2e/network/util.go:93:56: Using a reference for the variable on range scope "node"
e2e/node/kubelet.go:245:43: Using the variable on range scope "test" in function literal
e2e/node/kubelet.go:253:65: Using the variable on range scope "test" in function literal
e2e/node/kubelet.go:342:18: Using the variable on range scope "itArg" in function literal
e2e/node/kubelet.go:375:78: Using the variable on range scope "itArg" in function literal
e2e/node/kubelet.go:434:47: Using the variable on range scope "t" in function literal
e2e/node/node_problem_detector.go:127:89: Using the variable on range scope "node" in function literal
e2e/node/node_problem_detector.go:133:67: Using the variable on range scope "node" in function literal
e2e/node/node_problem_detector.go:141:67: Using the variable on range scope "node" in function literal
e2e/scheduling/preemption.go:85:26: Using a reference for the variable on range scope "node"
e2e/scheduling/preemption.go:132:26: Using a reference for the variable on range scope "node"
e2e/scheduling/preemption.go:218:26: Using a reference for the variable on range scope "node"
e2e/scheduling/priorities.go:510:94: Using a reference for the variable on range scope "pod"
e2e/scheduling/priorities.go:510:129: Using a reference for the variable on range scope "pod"
e2e/scheduling/priorities.go:512:24: Using a reference for the variable on range scope "pod"
e2e/scheduling/priorities.go:515:53: Using a reference for the variable on range scope "pod"
e2e/scheduling/priorities.go:516:53: Using a reference for the variable on range scope "pod"
e2e/storage/csi_mock_volume.go:1241:29: Using the variable on range scope "test" in function literal
e2e/storage/csi_mock_volume.go:1242:29: Using the variable on range scope "test" in function literal
e2e/storage/ephemeral_volume.go:56:38: Using the variable on range scope "testSource" in function literal
e2e/storage/ephemeral_volume.go:56:61: Using the variable on range scope "testSource" in function literal
e2e/storage/nfs_persistent_volume-disruptive.go:126:20: Using a reference for the variable on range scope "node"
e2e/storage/pd.go:279:21: Using the variable on range scope "t" in function literal
e2e/storage/persistent_volumes-local.go:600:43: Using a reference for the variable on range scope "pod"
e2e/storage/volume_limits.go:45:36: Using a reference for the variable on range scope "node"
e2e/storage/volume_provisioning.go:1047:42: Using a reference for the variable on range scope "pv"
e2e/storage/testsuites/subpath.go:593:26: Using a reference for the variable on range scope "ic"
e2e/storage/testsuites/subpath.go:965:85: Using a reference for the variable on range scope "node"
e2e/storage/vsphere/vsphere_scale.go:164:57: Using a reference for the variable on range scope "pod"
e2e/storage/vsphere/vsphere_scale.go:166:44: Using a reference for the variable on range scope "pod"
e2e/upgrades/apps/daemonsets.go:158:30: Using a reference for the variable on range scope "pod"
e2e/windows/kubelet_stats.go:110:27: Using a reference for the variable on range scope "n"
e2e/windows/kubelet_stats.go:110:60: Using a reference for the variable on range scope "n"
e2e_node/container_manager_test.go:85:41: Using the variable on range scope "pid" in function literal
e2e_node/garbage_collector_test.go:156:41: Using the variable on range scope "pod" in function literal
e2e_node/hugepages_test.go:261:41: Using the variable on range scope "count" in function literal
e2e_node/node_problem_detector_linux.go:402:79: Using the variable on range scope "test" in function literal
e2e_node/node_problem_detector_linux.go:406:84: Using the variable on range scope "test" in function literal
e2e_node/node_problem_detector_linux.go:410:84: Using the variable on range scope "test" in function literal
e2e_node/node_problem_detector_linux.go:415:64: Using the variable on range scope "test" in function literal
e2e_node/node_problem_detector_linux.go:415:84: Using the variable on range scope "test" in function literal
e2e_node/node_problem_detector_linux.go:415:106: Using the variable on range scope "test" in function literal
e2e_node/node_problem_detector_linux.go:419:64: Using the variable on range scope "test" in function literal
e2e_node/node_problem_detector_linux.go:419:84: Using the variable on range scope "test" in function literal
e2e_node/node_problem_detector_linux.go:419:106: Using the variable on range scope "test" in function literal
e2e_node/restart_test.go:49:44: Using a reference for the variable on range scope "pod"
e2e_node/restart_test.go:52:39: Using a reference for the variable on range scope "pod"
e2e_node/topology_manager_test.go:323:47: Using a reference for the variable on range scope "cnt"
e2e_node/topology_manager_test.go:342:57: Using a reference for the variable on range scope "cnt"
images/agnhost/audit-proxy/main.go:77:26: Using a reference for the variable on range scope "event"
images/agnhost/crd-conversion-webhook/converter/converter_test.go:76:48: Using the variable on range scope "tc" in function literal
images/agnhost/crd-conversion-webhook/converter/converter_test.go:83:39: Using the variable on range scope "tc" in function literal
images/agnhost/crd-conversion-webhook/converter/converter_test.go:87:11: Using the variable on range scope "tc" in function literal
images/agnhost/crd-conversion-webhook/converter/converter_test.go:89:37: Using the variable on range scope "tc" in function literal
images/agnhost/crd-conversion-webhook/converter/converter_test.go:90:67: Using the variable on range scope "tc" in function literal
images/agnhost/webhook/addlabel_test.go:56:70: Using the variable on range scope "tc" in function literal
images/agnhost/webhook/addlabel_test.go:81:41: Using the variable on range scope "tc" in function literal
images/agnhost/webhook/addlabel_test.go:82:67: Using the variable on range scope "tc" in function literal
images/regression-issue-74839/tcp_test.go:82:22: Using the variable on range scope "tc" in function literal
images/regression-issue-74839/tcp_test.go:86:14: Using the variable on range scope "tc" in function literal
images/regression-issue-74839/tcp_test.go:87:60: Using the variable on range scope "tc" in function literal
images/regression-issue-74839/tcp_test.go:87:69: Using the variable on range scope "tc" in function literal
instrumentation/main_test.go:108:64: Using the variable on range scope "test" in function literal
instrumentation/main_test.go:440:64: Using the variable on range scope "test" in function literal
instrumentation/main_test.go:447:7: Using the variable on range scope "test" in function literal
instrumentation/main_test.go:448:5: Using the variable on range scope "test" in function literal
instrumentation/main_test.go:450:38: Using the variable on range scope "test" in function literal
instrumentation/main_test.go:451:55: Using the variable on range scope "test" in function literal
instrumentation/main_test.go:678:58: Using the variable on range scope "test" in function literal
instrumentation/main_test.go:682:37: Using the variable on range scope "test" in function literal
instrumentation/main_test.go:683:53: Using the variable on range scope "test" in function literal
integration/apiserver/apiserver_test.go:256:89: Using the variable on range scope "path" in function literal
integration/apiserver/apiserver_test.go:333:35: Using the variable on range scope "watchCacheEnabled" in function literal
integration/apiserver/apiserver_test.go:429:32: Using the variable on range scope "rv" in function literal
integration/apiserver/apiserver_test.go:430:32: Using the variable on range scope "rvMatch" in function literal
integration/apiserver/apiserver_test.go:431:32: Using the variable on range scope "continueToken" in function literal
integration/apiserver/apiserver_test.go:432:32: Using the variable on range scope "limit" in function literal
integration/apiserver/apiserver_test.go:434:42: Using the variable on range scope "watchCacheEnabled" in function literal
integration/apiserver/apiserver_test.go:565:35: Using the variable on range scope "tc" in function literal
integration/apiserver/apiserver_test.go:582:7: Using the variable on range scope "tc" in function literal
integration/apiserver/apiserver_test.go:2210:28: Using the variable on range scope "i" in function literal
integration/apiserver/apiserver_test.go:2213:36: Using the variable on range scope "tc" in function literal
integration/apiserver/apiserver_test.go:2214:13: Using the variable on range scope "tc" in function literal
integration/apiserver/apiserver_test.go:2215:13: Using the variable on range scope "tc" in function literal
integration/apiserver/admissionwebhook/admission_test.go:619:31: Using the variable on range scope "gvr" in function literal
integration/apiserver/admissionwebhook/admission_test.go:623:31: Using the variable on range scope "gvr" in function literal
integration/apiserver/admissionwebhook/admission_test.go:623:36: Using the variable on range scope "verb" in function literal
integration/apiserver/admissionwebhook/admission_test.go:629:8: Using the variable on range scope "verb" in function literal
integration/apiserver/admissionwebhook/admission_test.go:629:25: Using the variable on range scope "verb" in function literal
integration/apiserver/admissionwebhook/admission_test.go:630:8: Using the variable on range scope "gvr" in function literal
integration/apiserver/admissionwebhook/admission_test.go:630:25: Using the variable on range scope "gvr" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:320:31: Using the variable on range scope "i" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:344:28: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:382:86: Using the variable on range scope "i" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:422:7: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:423:34: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:427:7: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:431:8: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:432:40: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:433:60: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:443:7: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:445:27: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:446:53: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:450:22: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:461:70: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/reinvocation_test.go:461:105: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:187:37: Using the variable on range scope "i" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:194:28: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:208:32: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:209:32: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:214:86: Using the variable on range scope "i" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:228:28: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:242:32: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:243:32: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:248:86: Using the variable on range scope "i" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:265:12: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:269:12: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:299:124: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:302:7: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:306:8: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:307:40: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:308:60: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:318:7: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:319:32: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:335:40: Using the variable on range scope "tt" in function literal
integration/apiserver/admissionwebhook/timeout_test.go:336:58: Using the variable on range scope "tt" in function literal
integration/auth/rbac_test.go:130:68: Using a reference for the variable on range scope "r"
integration/auth/rbac_test.go:136:72: Using a reference for the variable on range scope "r"
integration/auth/rbac_test.go:142:75: Using a reference for the variable on range scope "r"
integration/auth/rbac_test.go:148:79: Using a reference for the variable on range scope "r"
integration/certificates/admission_approval_test.go:65:57: Using the variable on range scope "test" in function literal
integration/certificates/admission_approval_test.go:67:97: Using the variable on range scope "test" in function literal
integration/certificates/admission_approval_test.go:81:21: Using the variable on range scope "test" in function literal
integration/certificates/admission_approval_test.go:82:47: Using the variable on range scope "test" in function literal
integration/certificates/admission_approval_test.go:84:21: Using the variable on range scope "test" in function literal
integration/certificates/admission_approval_test.go:85:58: Using the variable on range scope "test" in function literal
integration/certificates/admission_sign_test.go:65:54: Using the variable on range scope "test" in function literal
integration/certificates/admission_sign_test.go:67:97: Using the variable on range scope "test" in function literal
integration/certificates/admission_sign_test.go:77:21: Using the variable on range scope "test" in function literal
integration/certificates/admission_sign_test.go:78:47: Using the variable on range scope "test" in function literal
integration/certificates/admission_sign_test.go:80:21: Using the variable on range scope "test" in function literal
integration/certificates/admission_sign_test.go:81:58: Using the variable on range scope "test" in function literal
integration/certificates/admission_subjectrestriction_test.go:60:34: Using the variable on range scope "test" in function literal
integration/certificates/admission_subjectrestriction_test.go:60:51: Using the variable on range scope "test" in function literal
integration/certificates/admission_subjectrestriction_test.go:62:21: Using the variable on range scope "test" in function literal
integration/certificates/admission_subjectrestriction_test.go:63:47: Using the variable on range scope "test" in function literal
integration/certificates/admission_subjectrestriction_test.go:65:21: Using the variable on range scope "test" in function literal
integration/certificates/admission_subjectrestriction_test.go:66:58: Using the variable on range scope "test" in function literal
integration/certificates/controller_approval_test.go:112:7: Using the variable on range scope "test" in function literal
integration/certificates/controller_approval_test.go:113:47: Using the variable on range scope "test" in function literal
integration/certificates/controller_approval_test.go:115:7: Using the variable on range scope "test" in function literal
integration/certificates/controller_approval_test.go:116:47: Using the variable on range scope "test" in function literal
integration/certificates/controller_approval_test.go:122:47: Using the variable on range scope "test" in function literal
integration/certificates/controller_approval_test.go:132:18: Using the variable on range scope "test" in function literal
integration/certificates/controller_approval_test.go:133:18: Using the variable on range scope "test" in function literal
integration/certificates/controller_approval_test.go:134:19: Using the variable on range scope "test" in function literal
integration/certificates/controller_approval_test.go:142:7: Using the variable on range scope "test" in function literal
integration/certificates/defaulting_test.go:68:17: Using the variable on range scope "test" in function literal
integration/certificates/defaulting_test.go:74:31: Using the variable on range scope "test" in function literal
integration/certificates/defaulting_test.go:75:64: Using the variable on range scope "test" in function literal
integration/daemonset/daemonset_test.go:418:33: Using the variable on range scope "strategy" in function literal
integration/deployment/util.go:356:33: Using a reference for the variable on range scope "pod"
integration/dryrun/dryrun_test.go:260:15: Using the variable on range scope "resourceToTest" in function literal
integration/dryrun/dryrun_test.go:261:11: Using the variable on range scope "resourceToTest" in function literal
integration/dryrun/dryrun_test.go:262:18: Using the variable on range scope "resourceToTest" in function literal
integration/dryrun/dryrun_test.go:292:7: Using the variable on range scope "resourceToTest" in function literal
integration/dualstack/dualstack_endpoints_test.go:165:90: Using the variable on range scope "i" in function literal
integration/dualstack/dualstack_endpoints_test.go:204:44: Using the variable on range scope "i" in function literal
integration/dualstack/dualstack_endpoints_test.go:210:22: Using the variable on range scope "tc" in function literal
integration/dualstack/dualstack_endpoints_test.go:211:23: Using the variable on range scope "tc" in function literal
integration/dualstack/dualstack_endpoints_test.go:215:48: Using the variable on range scope "i" in function literal
integration/dualstack/dualstack_endpoints_test.go:242:63: Using the variable on range scope "tc" in function literal
integration/dualstack/dualstack_endpoints_test.go:245:105: Using the variable on range scope "tc" in function literal
integration/dualstack/dualstack_endpoints_test.go:262:33: Using the variable on range scope "tc" in function literal
integration/dualstack/dualstack_endpoints_test.go:267:30: Using the variable on range scope "tc" in function literal
integration/dualstack/dualstack_test.go:230:39: Using the variable on range scope "i" in function literal
integration/dualstack/dualstack_test.go:447:39: Using the variable on range scope "i" in function literal
integration/dualstack/dualstack_test.go:456:48: Using the variable on range scope "i" in function literal
integration/dualstack/dualstack_test.go:675:39: Using the variable on range scope "i" in function literal
integration/dualstack/dualstack_test.go:905:39: Using the variable on range scope "i" in function literal
integration/endpointslice/endpointslicemirroring_test.go:173:90: Using the variable on range scope "i" in function literal
integration/endpointslice/endpointslicemirroring_test.go:177:7: Using the variable on range scope "tc" in function literal
integration/endpointslice/endpointslicemirroring_test.go:178:20: Using the variable on range scope "tc" in function literal
integration/endpointslice/endpointslicemirroring_test.go:179:5: Using the variable on range scope "tc" in function literal
integration/endpointslice/endpointslicemirroring_test.go:180:71: Using the variable on range scope "tc" in function literal
integration/endpointslice/endpointslicemirroring_test.go:186:7: Using the variable on range scope "tc" in function literal
integration/endpointslice/endpointslicemirroring_test.go:187:20: Using the variable on range scope "tc" in function literal
integration/endpointslice/endpointslicemirroring_test.go:188:5: Using the variable on range scope "tc" in function literal
integration/endpointslice/endpointslicemirroring_test.go:189:72: Using the variable on range scope "tc" in function literal
integration/endpointslice/endpointslicemirroring_test.go:203:8: Using the variable on range scope "tc" in function literal
integration/endpointslice/endpointslicemirroring_test.go:212:9: Using the variable on range scope "tc" in function literal
integration/endpointslice/endpointslicemirroring_test.go:213:60: Using the variable on range scope "tc" in function literal
integration/endpointslice/endpointslicemirroring_test.go:214:87: Using the variable on range scope "tc" in function literal
integration/etcd/etcd_cross_group_test.go:83:16: Using the variable on range scope "resources" in function literal
integration/etcd/etcd_cross_group_test.go:109:29: Using the variable on range scope "resources" in function literal
integration/etcd/etcd_cross_group_test.go:121:29: Using the variable on range scope "resources" in function literal
integration/etcd/etcd_storage_path_test.go:73:15: Using the variable on range scope "resourceToPersist" in function literal
integration/etcd/etcd_storage_path_test.go:74:11: Using the variable on range scope "resourceToPersist" in function literal
integration/etcd/etcd_storage_path_test.go:75:18: Using the variable on range scope "resourceToPersist" in function literal
integration/ipamperf/ipam_test.go:143:7: Using the variable on range scope "test" in function literal
integration/ipamperf/ipam_test.go:143:64: Using the variable on range scope "test" in function literal
integration/ipamperf/ipam_test.go:151:4: Using the variable on range scope "test" in function literal
integration/ipamperf/ipam_test.go:152:42: Using the variable on range scope "test" in function literal
integration/master/audit_test.go:279:26: Using the variable on range scope "tc" in function literal
integration/master/audit_test.go:279:41: Using the variable on range scope "tc" in function literal
integration/master/audit_test.go:279:67: Using the variable on range scope "tc" in function literal
integration/master/kube_apiserver_test.go:541:58: Using the variable on range scope "i" in function literal
integration/master/synthetic_master_test.go:345:90: Using the variable on range scope "r" in function literal
integration/master/synthetic_master_test.go:347:39: Using the variable on range scope "r" in function literal
integration/master/synthetic_master_test.go:348:48: Using the variable on range scope "r" in function literal
integration/metrics/metrics_test.go:335:4: Using the variable on range scope "tc" in function literal
integration/metrics/metrics_test.go:346:34: Using the variable on range scope "tc" in function literal
integration/metrics/metrics_test.go:353:77: Using the variable on range scope "tc" in function literal
integration/metrics/metrics_test.go:441:4: Using the variable on range scope "tc" in function literal
integration/metrics/metrics_test.go:452:34: Using the variable on range scope "tc" in function literal
integration/metrics/metrics_test.go:459:77: Using the variable on range scope "tc" in function literal
integration/node/lifecycle_test.go:205:7: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:206:5: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:206:47: Using the variable on range scope "i" in function literal
integration/node/lifecycle_test.go:207:12: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:208:6: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:208:74: Using the variable on range scope "i" in function literal
integration/node/lifecycle_test.go:211:5: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:211:78: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:216:50: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:218:7: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:218:27: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:220:5: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:220:75: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:224:63: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:226:78: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:243:42: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:251:20: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:256:62: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:279:58: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:280:63: Using the variable on range scope "i" in function literal
integration/node/lifecycle_test.go:283:7: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:284:52: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:284:67: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:287:27: Using the variable on range scope "i" in function literal
integration/node/lifecycle_test.go:291:43: Using the variable on range scope "i" in function literal
integration/node/lifecycle_test.go:296:70: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:297:73: Using the variable on range scope "test" in function literal
integration/node/lifecycle_test.go:299:44: Using the variable on range scope "test" in function literal
integration/replicaset/replicaset_test.go:452:13: Using the variable on range scope "tc" in function literal
integration/replicationcontroller/replicationcontroller_test.go:441:13: Using the variable on range scope "tc" in function literal
integration/scheduler/extender_test.go:165:37: Using a reference for the variable on range scope "node"
integration/scheduler/framework_test.go:555:36: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:556:38: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:564:7: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:564:22: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:647:32: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:648:28: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:649:40: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:691:62: Using the variable on range scope "i" in function literal
integration/scheduler/framework_test.go:692:9: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:704:7: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:709:94: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:710:89: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:712:90: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:713:88: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:715:47: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:716:93: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:722:95: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:723:80: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:725:91: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:726:79: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:728:48: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:729:84: Using the variable on range scope "tt" in function literal
integration/scheduler/framework_test.go:776:28: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:784:7: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:899:32: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:907:7: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:983:32: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:984:34: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:992:7: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:992:20: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1088:32: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1089:7: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1090:20: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1099:7: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1099:27: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1230:29: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1231:29: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1245:7: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1245:38: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1254:8: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1262:50: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1263:93: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1268:9: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1290:19: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1291:20: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1333:18: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1378:7: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1462:27: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1463:29: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1464:30: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1474:7: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1479:8: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1479:23: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1632:39: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1633:38: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1648:7: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1726:30: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1734:7: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1798:34: Using the variable on range scope "test" in function literal
integration/scheduler/framework_test.go:1806:7: Using the variable on range scope "test" in function literal
integration/scheduler/predicates_test.go:807:24: Using the variable on range scope "test" in function literal
integration/scheduler/predicates_test.go:823:77: Using the variable on range scope "test" in function literal
integration/scheduler/predicates_test.go:825:10: Using the variable on range scope "test" in function literal
integration/scheduler/predicates_test.go:830:7: Using the variable on range scope "test" in function literal
integration/scheduler/predicates_test.go:839:67: Using the variable on range scope "test" in function literal
integration/scheduler/predicates_test.go:843:101: Using the variable on range scope "test" in function literal
integration/scheduler/predicates_test.go:847:24: Using the variable on range scope "test" in function literal
integration/scheduler/predicates_test.go:983:22: Using the variable on range scope "tt" in function literal
integration/scheduler/predicates_test.go:983:39: Using the variable on range scope "tt" in function literal
integration/scheduler/predicates_test.go:985:24: Using the variable on range scope "tt" in function literal
integration/scheduler/predicates_test.go:995:37: Using the variable on range scope "tt" in function literal
integration/scheduler/predicates_test.go:995:86: Using the variable on range scope "tt" in function literal
integration/scheduler/predicates_test.go:1000:7: Using the variable on range scope "tt" in function literal
integration/scheduler/predicates_test.go:1001:112: Using the variable on range scope "tt" in function literal
integration/scheduler/predicates_test.go:1172:7: Using the variable on range scope "tt" in function literal
integration/scheduler/predicates_test.go:1173:15: Using the variable on range scope "tt" in function literal
integration/scheduler/predicates_test.go:1177:4: Using the variable on range scope "tt" in function literal
integration/scheduler/predicates_test.go:1178:63: Using the variable on range scope "tt" in function literal
integration/scheduler/predicates_test.go:1185:14: Using the variable on range scope "tt" in function literal
integration/scheduler/preemption_test.go:394:20: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:395:26: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:396:32: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:398:22: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:405:41: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:411:20: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:422:11: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:490:38: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:506:14: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:566:32: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:568:22: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:571:57: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:575:41: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:674:10: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:675:33: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:677:9: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:678:70: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:680:24: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:681:77: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:681:97: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:687:31: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:688:76: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:691:76: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:763:35: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:764:22: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:764:44: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:780:20: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:794:41: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:864:7: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:865:5: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:867:20: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:868:36: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:869:39: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:871:21: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:885:42: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:891:21: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:1248:29: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:1255:32: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:1258:22: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:1260:57: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:1269:44: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:1274:24: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:1281:41: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:1281:52: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:1286:41: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:1292:20: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:1294:64: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:1298:72: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:1303:11: Using the variable on range scope "test" in function literal
integration/scheduler/preemption_test.go:1305:85: Using the variable on range scope "test" in function literal
integration/scheduler/priorities_test.go:335:22: Using the variable on range scope "tt" in function literal
integration/scheduler/priorities_test.go:335:39: Using the variable on range scope "tt" in function literal
integration/scheduler/priorities_test.go:337:24: Using the variable on range scope "tt" in function literal
integration/scheduler/priorities_test.go:347:37: Using the variable on range scope "tt" in function literal
integration/scheduler/priorities_test.go:347:86: Using the variable on range scope "tt" in function literal
integration/scheduler/priorities_test.go:352:7: Using the variable on range scope "tt" in function literal
integration/scheduler/priorities_test.go:353:112: Using the variable on range scope "tt" in function literal
integration/scheduler/priorities_test.go:412:20: Using the variable on range scope "nPods" in function literal
integration/scheduler/scheduler_test.go:830:29: Using the variable on range scope "test" in function literal
integration/scheduler/scheduler_test.go:837:57: Using the variable on range scope "test" in function literal
integration/scheduler/scheduler_test.go:841:32: Using the variable on range scope "test" in function literal
integration/scheduler/scheduler_test.go:844:22: Using the variable on range scope "test" in function literal
integration/scheduler/scheduler_test.go:850:45: Using the variable on range scope "test" in function literal
integration/scheduler/taint_test.go:516:21: Using the variable on range scope "test" in function literal
integration/scheduler/taint_test.go:517:21: Using the variable on range scope "test" in function literal
integration/scheduler/taint_test.go:522:19: Using the variable on range scope "test" in function literal
integration/scheduler/taint_test.go:529:52: Using the variable on range scope "test" in function literal
integration/scheduler/taint_test.go:535:86: Using the variable on range scope "test" in function literal
integration/scheduler/taint_test.go:539:22: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:62:58: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:63:24: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:63:43: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:87:20: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:91:24: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:91:43: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:107:58: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:108:24: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:108:43: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:124:58: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:125:24: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:125:43: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:143:58: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:144:24: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:144:43: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:176:58: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:177:24: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:177:43: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:205:58: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:206:24: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:206:43: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:225:58: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:226:24: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:226:43: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:245:20: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:249:24: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:249:43: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:268:20: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:272:24: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:272:43: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:288:58: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:289:24: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_legacy_test.go:289:43: Using the variable on range scope "test" in function literal
integration/scheduler_perf/scheduler_perf_test.go:294:22: Using the variable on range scope "tc" in function literal
integration/scheduler_perf/scheduler_perf_test.go:296:33: Using the variable on range scope "tc" in function literal
integration/scheduler_perf/scheduler_perf_test.go:299:71: Using the variable on range scope "tc" in function literal
integration/scheduler_perf/scheduler_perf_test.go:299:75: Using the variable on range scope "w" in function literal
integration/serving/serving_test.go:172:21: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:172:93: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:250:116: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:254:23: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:255:63: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:261:20: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:264:77: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:286:9: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:291:54: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:299:40: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:300:76: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:304:20: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:307:78: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:310:54: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:317:40: Using the variable on range scope "tt" in function literal
integration/serving/serving_test.go:318:76: Using the variable on range scope "tt" in function literal
integration/util/util.go:264:50: Using a reference for the variable on range scope "taint"
integration/volumescheduling/volume_binding_test.go:856:43: Using the variable on range scope "test" in function literal
integration/volumescheduling/volume_binding_test.go:998:43: Using the variable on range scope "test" in function literal
utils/audit.go:124:40: Using a reference for the variable on range scope "e"
utils/audit.go:141:40: Using a reference for the variable on range scope "e"
utils/deployment.go:66:30: Using a reference for the variable on range scope "pod"
utils/image/manifest_test.go:129:40: Using the variable on range scope "tt" in function literal
utils/image/manifest_test.go:131:36: Using the variable on range scope "tt" in function literal
utils/image/manifest_test.go:132:38: Using the variable on range scope "tt" in function literal
utils/image/manifest_test.go:135:12: Using the variable on range scope "tt" in function literal
utils/image/manifest_test.go:136:36: Using the variable on range scope "tt" in function literal

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 18 (15 by maintainers)

Commits related to this issue

Most upvoted comments

I’m working on a WIP linter to detect this kind of thing, it found much less instances of this than I expected in this repo. I fixed them in #111846

I think a lot of these are false positives.

For example, the first one scopelint identified: https://github.com/kubernetes/kubernetes/blob/d4883f532e8a3e138c5ef2e65382eba41ad35136/test/conformance/walk_test.go#L163-L170

Without any knowledge of how t.Run() works, it would seem to be a potential problem because that func could be executed asynchronolusly or at some time in the future after the next iteration of the for loop has occurred. But if you look at the actual the implementation of t.Run() you can see that it waits for the func to finish before returning.

Regardless, scopelint is obsolete as @uthark said, and its repo recommends using either looppointer or exportloopref. @uthark it looks like you started to go down the path of using exportloopref in your PR.

Out of curiosity, I ran exportloopref from k/k root and got a much more manageable list of problems:

~/go/src/k8s.io/kubernetes (master)* $ exportloopref ./...
/home/bpursley/go/src/k8s.io/kubernetes/test/e2e/framework/pods.go:271:11: exporting a pointer for the loop variable e
/home/bpursley/go/src/k8s.io/kubernetes/test/e2e/framework/util.go:1394:50: exporting a pointer for the loop variable watchEventIndex
/home/bpursley/go/src/k8s.io/kubernetes/test/e2e/apimachinery/custom_resource_definition.go:207:15: exporting a pointer for the loop variable g
/home/bpursley/go/src/k8s.io/kubernetes/test/e2e/apimachinery/custom_resource_definition.go:217:17: exporting a pointer for the loop variable v
/home/bpursley/go/src/k8s.io/kubernetes/test/e2e/apimachinery/custom_resource_definition.go:235:17: exporting a pointer for the loop variable v
/home/bpursley/go/src/k8s.io/kubernetes/test/e2e/apimachinery/webhook.go:125:15: exporting a pointer for the loop variable g
/home/bpursley/go/src/k8s.io/kubernetes/test/e2e/apimachinery/webhook.go:135:17: exporting a pointer for the loop variable v
/home/bpursley/go/src/k8s.io/kubernetes/test/e2e/apimachinery/webhook.go:153:17: exporting a pointer for the loop variable v
/home/bpursley/go/src/k8s.io/kubernetes/test/e2e/auth/service_accounts.go:568:43: exporting a pointer for the loop variable tc
/home/bpursley/go/src/k8s.io/kubernetes/test/e2e/auth/service_accounts.go:571:41: exporting a pointer for the loop variable tc
/home/bpursley/go/src/k8s.io/kubernetes/test/e2e/autoscaling/cluster_size_autoscaling.go:1253:27: exporting a pointer for the loop variable node
/home/bpursley/go/src/k8s.io/kubernetes/test/e2e/storage/nfs_persistent_volume-disruptive.go:126:20: exporting a pointer for the loop variable node
/home/bpursley/go/src/k8s.io/kubernetes/test/e2e/storage/volume_provisioning.go:971:42: exporting a pointer for the loop variable pv
/home/bpursley/go/src/k8s.io/kubernetes/pkg/proxy/userspace/proxier_test.go:117:19: exporting a pointer for the loop variable port
/home/bpursley/go/src/k8s.io/kubernetes/plugin/pkg/admission/securitycontext/scdeny/admission_test.go:143:31: exporting a pointer for the loop variable test
/home/bpursley/go/src/k8s.io/kubernetes/test/e2e_node/restart_test.go:57:39: exporting a pointer for the loop variable pod

A lot of these are probably not actually causing a problem either because often times the code breaks out of the loop immediately upon assigning the ref, so another iteration does not occur.

There were some of them though that might be a problem and need to be fixed, like this one perhaps:

https://github.com/kubernetes/kubernetes/blob/c8f87a6a243ab6d2e9f3503a5d363385aefd9244/test/e2e/autoscaling/cluster_size_autoscaling.go#L1244-L1257

@uthark are you still thinking about adding exportloopref as one of the linters?