Skip to content

Enable bodyclose, makezero, and sqlclosecheck linters#2219

Merged
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/upgrade-golangci-lint-enable-more-linter-4541fe11
Mar 23, 2026
Merged

Enable bodyclose, makezero, and sqlclosecheck linters#2219
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/upgrade-golangci-lint-enable-more-linter-4541fe11

Conversation

@dgageot
Copy link
Member

@dgageot dgageot commented Mar 23, 2026

Add three new linters to golangci-lint configuration and fix all reported issues:

  • bodyclose: ensure HTTP response bodies are closed in tests; add nolint for false positives (websocket upgrade, goroutine-deferred close)
  • makezero: use make+append instead of make+copy in hasCycle
  • sqlclosecheck: use defer rows.Close() instead of manual close calls

Add three new linters to golangci-lint configuration and fix all reported issues:
- bodyclose: ensure HTTP response bodies are closed in tests; add nolint for false positives (websocket upgrade, goroutine-deferred close)
- makezero: use make+append instead of make+copy in hasCycle
- sqlclosecheck: use defer rows.Close() instead of manual close calls

Assisted-By: docker-agent
@dgageot dgageot requested a review from a team as a code owner March 23, 2026 07:21
Copy link

@docker-agent docker-agent bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

This PR cleanly enables three new golangci-lint linters and fixes all reported issues:

  • bodyclose: Adds defer resp.Body.Close() in test files, with appropriate //nolint directives for websocket upgrades and goroutine-deferred closes
  • makezero: Optimizes slice initialization in hasCycle function (make+append instead of make+copy)
  • sqlclosecheck: Consolidates manual rows.Close() calls into a single defer rows.Close() statement, properly placed after error checking

All changes are linter-driven improvements with no bugs introduced. The defer rows.Close() placement is correct (after error checks), and the slice optimization is functionally equivalent.

@dgageot dgageot merged commit 09e1ac1 into docker:main Mar 23, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants