Skip to content

Fix impossible type assertion in Remove method#8

Merged
warkanum merged 2 commits intoserverfrom
copilot/sub-pr-5
Dec 30, 2025
Merged

Fix impossible type assertion in Remove method#8
warkanum merged 2 commits intoserverfrom
copilot/sub-pr-5

Conversation

Copy link
Contributor

Copilot AI commented Dec 30, 2025

The Remove method attempted to type assert Instance interface to *gracefulServer, but gracefulServer doesn't implement Instance (missing Addr() method). This caused go vet and linter failures.

Changes:

  • Changed type assertion from instance.(*gracefulServer) to instance.(*serverInstance)
  • Updated field access to si.gracefulServer.shutdownTimeout to traverse the wrapper struct
  • Added nil check for si.gracefulServer before accessing shutdownTimeout
// Before (broken)
if gs, ok := instance.(*gracefulServer); ok && gs.shutdownTimeout > 0 {
    timeout = gs.shutdownTimeout
}

// After (fixed)
if si, ok := instance.(*serverInstance); ok && si.gracefulServer != nil && si.gracefulServer.shutdownTimeout > 0 {
    timeout = si.gracefulServer.shutdownTimeout
}

The serverInstance struct properly implements the Instance interface and wraps gracefulServer internally.


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

Co-authored-by: warkanum <208308+warkanum@users.noreply.github.com>
Copilot AI changed the title [WIP] Introduce server manager for enhanced HTTP/HTTPS handling Fix impossible type assertion in Remove method Dec 30, 2025
Copilot AI requested a review from warkanum December 30, 2025 11:46
@warkanum warkanum marked this pull request as ready for review December 30, 2025 12:04
@warkanum warkanum merged commit 3d5d7b7 into server Dec 30, 2025
@warkanum warkanum deleted the copilot/sub-pr-5 branch December 30, 2025 12:04
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