Skip to content

Remove redundant nil check in sys_test.go#285

Merged
lpcox merged 2 commits intomainfrom
copilot/fix-linting-error
Jan 16, 2026
Merged

Remove redundant nil check in sys_test.go#285
lpcox merged 2 commits intomainfrom
copilot/fix-linting-error

Conversation

Copy link
Contributor

Copilot AI commented Jan 16, 2026

Staticcheck S1009 flagged a redundant nil check before calling len() on a slice. In Go, len() returns 0 for nil slices, making the explicit nil check unnecessary.

Changes

  • Removed redundant tt.serverIDs != nil check in TestNewSysServer
// Before
if tt.serverIDs != nil && len(tt.serverIDs) > 0 {
    assert.Equal(t, tt.serverIDs, server.serverIDs, "Server IDs should match")
}

// After
if len(tt.serverIDs) > 0 {
    assert.Equal(t, tt.serverIDs, server.serverIDs, "Server IDs should match")
}

The test behavior remains identical - len() on a nil slice evaluates to 0, so the condition is false for both nil and empty slices.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix linting error in sys_test.go Remove redundant nil check in sys_test.go Jan 16, 2026
Copilot AI requested a review from lpcox January 16, 2026 06:11
@lpcox lpcox marked this pull request as ready for review January 16, 2026 06:13
@lpcox lpcox merged commit 241f4cb into main Jan 16, 2026
3 checks passed
@lpcox lpcox deleted the copilot/fix-linting-error branch January 16, 2026 06:13
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