Skip to content

Commit

Permalink
add contextcheck linter exceptions
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
  • Loading branch information
inteon committed May 7, 2024
1 parent de54201 commit 1248be8
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmd/acmesolver/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func NewACMESolverCommand(_ context.Context) *cobra.Command {

return nil
},
// nolint:contextcheck // False positive
RunE: func(cmd *cobra.Command, args []string) error {
runCtx := cmd.Context()
log := logf.FromContext(runCtx)
Expand Down
1 change: 1 addition & 0 deletions cmd/cainjector/app/cainjector.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ servers and webhook servers.`,

return nil
},
// nolint:contextcheck // False positive
RunE: func(cmd *cobra.Command, args []string) error {
return run(cmd.Context(), cainjectorConfig)
},
Expand Down
1 change: 1 addition & 0 deletions cmd/controller/app/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ to renew certificates at an appropriate time before expiry.`,

return nil
},
// nolint:contextcheck // False positive
RunE: func(cmd *cobra.Command, args []string) error {
return run(cmd.Context(), controllerConfig)
},
Expand Down
1 change: 1 addition & 0 deletions cmd/startupapicheck/pkg/check/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ required webhooks are reachable by the K8S API server.`,
PreRunE: func(cmd *cobra.Command, args []string) error {
return o.Complete()
},
// nolint:contextcheck // False positive
RunE: func(cmd *cobra.Command, args []string) error {
return o.Run(cmd.Context(), cmd.OutOrStdout())
},
Expand Down
1 change: 1 addition & 0 deletions cmd/webhook/app/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ functionality for cert-manager.`,

return nil
},
// nolint:contextcheck // False positive
RunE: func(cmd *cobra.Command, args []string) error {
return run(cmd.Context(), webhookConfig)
},
Expand Down
1 change: 1 addition & 0 deletions pkg/acme/webhook/cmd/server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func NewCommandStartWebhookServer(_ context.Context, groupName string, solvers .
cmd := &cobra.Command{
Short: "Launch an ACME solver API server",
Long: "Launch an ACME solver API server",
// nolint:contextcheck // False positive
RunE: func(c *cobra.Command, args []string) error {
runCtx := c.Context()

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/suite/conformance/certificates/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -1065,13 +1065,13 @@ cKK5t8N1YDX5CV+01X3vvxpM3ciYuCY9y+lSegrIEI+izRyD7P9KaZlwMaYmsBZq
By("Updating the Certificate after having added an additional dnsName")
newDNSName := e2eutil.RandomSubdomain(s.DomainSuffix)
retry.RetryOnConflict(retry.DefaultRetry, func() error {
err = f.CRClient.Get(context.Background(), types.NamespacedName{Name: testCertificate.Name, Namespace: testCertificate.Namespace}, testCertificate)
err = f.CRClient.Get(ctx, types.NamespacedName{Name: testCertificate.Name, Namespace: testCertificate.Namespace}, testCertificate)
if err != nil {
return err
}

testCertificate.Spec.DNSNames = append(testCertificate.Spec.DNSNames, newDNSName)
err = f.CRClient.Update(context.Background(), testCertificate)
err = f.CRClient.Update(ctx, testCertificate)
if err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,11 @@ func (s *Suite) Define() {
// Create the request, and delete at the end of the test
By("Creating a CertificateSigningRequest")
Expect(f.CRClient.Create(ctx, kubeCSR)).NotTo(HaveOccurred())
// nolint: contextcheck // This is a cleanup context
defer func() {
// nolint: contextcheck // This is a cleanup context
f.CRClient.Delete(context.TODO(), kubeCSR)
cleanupCtx := context.Background()

f.CRClient.Delete(cleanupCtx, kubeCSR)
}()

// Approve the request for testing, so that cert-manager may sign the
Expand Down

0 comments on commit 1248be8

Please sign in to comment.