Merge pull request #5407 from renatolabs/loopvar-capture-fixes

Fix incorrect uses of loop variable
This commit is contained in:
jetstack-bot 2022-08-30 10:21:31 +01:00 committed by GitHub
commit 35b2d01d8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -119,6 +119,7 @@ func (c *controller) Run(workers int, stopCh <-chan struct{}) error {
}
for _, f := range c.runDurationFuncs {
f := f // capture range variable
go wait.Until(func() { f.fn(ctx) }, f.duration, stopCh)
}

View File

@ -163,6 +163,7 @@ var _ = framework.CertManagerDescribe("SelfSigned CertificateRequest", func() {
},
}
for _, v := range cases {
v := v // capture range variable
It("should generate a signed certificate valid for "+v.label, func() {
crClient := f.CertManagerClientSet.CertmanagerV1().CertificateRequests(f.Namespace.Name)
@ -172,6 +173,7 @@ var _ = framework.CertManagerDescribe("SelfSigned CertificateRequest", func() {
_, err = crClient.Create(context.TODO(), gen.CertificateRequestFrom(basicCR,
gen.SetCertificateRequestCSR(csr),
gen.SetCertificateRequestDuration(v.inputDuration),
), metav1.CreateOptions{})
Expect(err).NotTo(HaveOccurred())