Skip to content

Enable additional golangci-lint checks - #3415

Merged
tbavelier merged 2 commits into
mainfrom
tbavelier/enable-linters
Sep 2, 2026
Merged

Enable additional golangci-lint checks#3415
tbavelier merged 2 commits into
mainfrom
tbavelier/enable-linters

Conversation

@tbavelier

@tbavelier tbavelier commented Sep 2, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Enables eleven low-churn golangci-lint checks:

  • bodyclose, containedctx, dupword, errchkjson, gomoddirectives
  • musttag, nolintlint, rowserrcheck, sqlclosecheck, staticcheck, wastedassign

It also enables the Staticcheck correctness and quick-fix analyzers, fixes the resulting findings, and updates legacy golangci-lint v2 configuration keys.

Motivation

Several useful correctness, resource-safety, and configuration checks were disabled globally. Enabling the clean or tractable checks prevents new violations while keeping the initial rollout reviewable.

Additional Notes

This is the base of a two-PR branch stack. Follow-up #3416 enables the actionable Staticcheck style checks.

Next linters and analyzer groups to evaluate:

  • errcheck (50+ existing findings), prioritizing meaningful unchecked returns over output/cleanup noise
  • gosec (50+ findings), with a security-focused review of each suppression
  • contextcheck (62 findings), which requires context propagation through controller call chains
  • forcetypeassert (24 findings) and exhaustive (19 findings), both requiring behavioral decisions
  • SA1019, after planning controller-runtime typed-apply and event-recorder migrations

Minimum Agent Versions

No minimum Datadog Agent or Cluster Agent version is required.

Describe your test plan

  • make generate && make manifests
  • go test ./...
  • make fmt
  • make lint
  • golangci-lint config verify

Checklist

  • PR has at least one valid label: enhancement
  • PR has milestone v1.31.0 and label qa/skip-qa
  • All commits are signed

@datadog-datadog-prod-us1-2

This comment has been minimized.

@tbavelier
tbavelier marked this pull request as ready for review September 2, 2026 10:01
@tbavelier
tbavelier requested a review from a team September 2, 2026 10:01
@tbavelier
tbavelier requested review from a team as code owners September 2, 2026 10:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T10:04:00.434334Z bb874b4 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tbavelier
tbavelier merged commit 3e86172 into main Sep 2, 2026
53 of 54 checks passed
@tbavelier
tbavelier deleted the tbavelier/enable-linters branch September 2, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants