chore: upgrade golangci-lint to v2.12.2#55
Conversation
WalkthroughThis PR updates golangci-lint from v2.2.2 to v2.12.2, refactors interface compliance assertions in two test files to use direct nil-pointer type checks, and adjusts HTTP response cleanup to suppress close errors via an inline defer wrapper. ChangesTool Updates and Code Patterns
🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Updates the repository’s Go lint tooling to a newer golangci-lint release to restore compatibility with newer Go toolchains, and adjusts a few code/test patterns to satisfy newly-enabled lint checks.
Changes:
- Bump
golangci-lintversion in the Makefile tov2.12.2. - Address new lint findings by explicitly ignoring
Close()errors on HTTP response bodies. - Update interface compliance tests to use compile-time assertions against concrete types and suppress a new staticcheck finding.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pkg/httpclient/client.go |
Adjusts response body close handling to satisfy errcheck-style linting. |
Makefile |
Pins golangci-lint version to v2.12.2 (but the lint target install command still appears inconsistent with v2). |
internal/service/organization_search_test.go |
Updates interface compliance assertions and adds a //nolint:staticcheck suppression (which appears avoidable). |
cmd/service/service_test.go |
Updates interface compliance assertion to a compile-time check against the concrete service type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Bump golangci-lint from v2.2.2 to v2.12.2 (built with go1.25.10) to resolve build failure against go 1.25.0. Fix four new lint issues surfaced by the upgrade. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
2da0b81 to
250cdae
Compare
Review Feedback AddressedCommit: 250cdae Changes Made
Threads Resolved2 of 2 unresolved threads addressed. |
| lint: ## Run golangci-lint (local Go linting) | ||
| @echo "Running golangci-lint..." | ||
| @which golangci-lint >/dev/null 2>&1 || (echo "Installing golangci-lint..." && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest) | ||
| @which golangci-lint >/dev/null 2>&1 || (echo "Installing golangci-lint..." && go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)) | ||
| @golangci-lint run ./... && echo "==> Lint OK" |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cmd/service/service_test.go (1)
590-599: 💤 Low valueConsider simplifying the test now that compile-time check uses nil pointer.
The test instantiates
servicewith mocks (lines 592-595) but only uses it for aNotNilassertion (line 598). Since the interface compliance check now uses the nil pointer pattern(*querySvcsrvc)(nil), you could either:
- Remove the service instantiation and NotNil check entirely (the compile-time check is sufficient for interface compliance)
- Move the construction and NotNil check to a separate test if you want to verify the constructor behavior
The current code works fine, but streamlining would make the test's intent clearer.
♻️ Optional streamlined version
func TestQuerySvcsrvc_InterfaceCompliance(t *testing.T) { - // Verify that querySvcsrvc implements the querysvc.Service interface - mockResourceSearcher := mock.NewMockResourceSearcher() - mockAccessChecker := mock.NewMockAccessControlChecker() - mockOrgSearcher := mock.NewMockOrganizationSearcher() - service := NewQuerySvc(mockResourceSearcher, mockAccessChecker, mock.NewMockResourceFilter(), mockOrgSearcher, mock.NewMockAuthService()) - + // Compile-time check that querySvcsrvc implements querysvc.Service var _ querysvc.Service = (*querySvcsrvc)(nil) - assert.NotNil(t, service) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/service/service_test.go` around lines 590 - 599, The test TestQuerySvcsrvc_InterfaceCompliance should only perform the compile-time interface check using (*querySvcsrvc)(nil); remove the unnecessary runtime instantiation and assert by deleting the mock setup (mock.NewMockResourceSearcher, mock.NewMockAccessControlChecker, mock.NewMockOrganizationSearcher, mock.NewMockResourceFilter, mock.NewMockAuthService) and the assert.NotNil(t, service) lines, or if you want to keep constructor verification, move that instantiation and the NotNil assertion into a separate test (e.g., TestNewQuerySvc_ReturnsNonNil) that calls NewQuerySvc and asserts non-nil.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@cmd/service/service_test.go`:
- Around line 590-599: The test TestQuerySvcsrvc_InterfaceCompliance should only
perform the compile-time interface check using (*querySvcsrvc)(nil); remove the
unnecessary runtime instantiation and assert by deleting the mock setup
(mock.NewMockResourceSearcher, mock.NewMockAccessControlChecker,
mock.NewMockOrganizationSearcher, mock.NewMockResourceFilter,
mock.NewMockAuthService) and the assert.NotNil(t, service) lines, or if you want
to keep constructor verification, move that instantiation and the NotNil
assertion into a separate test (e.g., TestNewQuerySvc_ReturnsNonNil) that calls
NewQuerySvc and asserts non-nil.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cbfceb9a-a281-4f41-b682-0739f2af559d
📒 Files selected for processing (4)
Makefilecmd/service/service_test.gointernal/service/organization_search_test.gopkg/httpclient/client.go
Bump golangci-lint from v2.2.2 to v2.12.2 (built with go1.25.10) to resolve build failure against go 1.25.0. Fix four new lint issues surfaced by the upgrade.
🤖 Generated with Claude Code