Skip to content

test(mcp): fix staticcheck SA5011 nil-pointer errors in oauth_test#2989

Merged
dgageot merged 1 commit into
docker:mainfrom
dgageot:board/33a6c1222c698e3c
Jun 3, 2026
Merged

test(mcp): fix staticcheck SA5011 nil-pointer errors in oauth_test#2989
dgageot merged 1 commit into
docker:mainfrom
dgageot:board/33a6c1222c698e3c

Conversation

@dgageot

@dgageot dgageot commented Jun 3, 2026

Copy link
Copy Markdown
Member

The main branch CI was failing with 6 golangci-lint staticcheck SA5011 ("possible nil pointer dereference") errors in oauth_test. These were triggered by three if got == nil { t.Fatal(...) } guards that staticcheck did not recognize as terminating the execution path, so it flagged subsequent got.AccessToken accesses as potentially accessing a nil pointer.

Replacing these three guards with require.NotNil(t, got, ...) from testify removes the explicit nil comparison that trips staticcheck, while preserving the same fail-fast behavior and readability. The require helper is already in use throughout the test file.

Tests and linter pass locally.

@dgageot dgageot requested a review from a team as a code owner June 3, 2026 12:13

@docker-agent docker-agent left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Assessment: 🟢 APPROVE

This PR is a clean, targeted lint fix. The three if got == nil { t.Fatal(...) } guards are replaced with semantically equivalent require.NotNil(t, got, ...) calls from testify. Since require.NotNil calls t.FailNow() internally, the fail-fast behavior is preserved. No logic changes, no new control-flow paths, no resource management issues, and no security implications. The fix correctly resolves the staticcheck SA5011 false positives.

No bugs found in the changed code.

@dgageot dgageot merged commit ca5ea31 into docker:main Jun 3, 2026
8 checks passed
@aheritier aheritier added area/mcp MCP protocol, MCP tool servers, integration kind/test Test-only changes labels Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/mcp MCP protocol, MCP tool servers, integration kind/test Test-only changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants