Aias00 commented on PR #3439:
URL: https://github.com/apache/dubbo-go/pull/3439#issuecomment-4727598307
## Addressing Copilot Review Feedback
Thanks for the thorough review! All three issues have been fixed in the
latest push:
### 1. `atomic.Value.Store(nil)` panic ✅ Fixed
**Problem:** `atomic.Value.Store(nil)` panics at runtime.
**Fix:** Introduced `stickyInvokerWrapper` struct to wrap `base.Invoker`:
```go
type stickyInvokerWrapper struct {
invoker base.Invoker
}
```
Now clearing the sticky invoker stores `stickyInvokerWrapper{invoker: nil}`
(non-nil wrapper with nil inner value), which is safe.
### 2. Inconsistent concrete type panic ✅ Fixed
**Problem:** `atomic.Value` requires all stored values to have the same
concrete dynamic type. Different `base.Invoker` implementations would cause a
panic.
**Fix:** The `stickyInvokerWrapper` type is always the same regardless of
the concrete `base.Invoker` implementation stored inside.
### 3. Test calling `getStickyInvoker()` instead of `IsAvailable()` ✅ Fixed
**Problem:** `TestStickyConcurrentIsAvailableAndDoSelect` called the
unexported `getStickyInvoker()` instead of the public API `IsAvailable()`.
**Fix:** Test now uses `NewBaseClusterInvoker()` with a proper
`mockDirectory` implementation so `IsAvailable()` works end-to-end without
panicking on nil Directory.
### 4. Import formatting ✅ Fixed
Ran `make fmt` (imports-formatter) to match project convention (separate
import groups for stdlib, third-party, and internal packages).
### CI Notes
- **Check Code Format**: Should pass now after running `make fmt`
- **Integration Test failure**: Pre-existing infrastructure timeout, not
related to this change
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]