Aias00 opened a new pull request, #982:
URL: https://github.com/apache/dubbo-go-pixiu/pull/982

   ## Summary
   
   Migrate all Nacos SDK usage from the deprecated v1.1.3 (2020) to v2.3.2, 
consolidating on a single version and eliminating dependency bloat and 
potential security issues.
   
   ## Problem
   
   The project had both `github.com/nacos-group/nacos-sdk-go v1.1.3` and 
`github.com/nacos-group/nacos-sdk-go/v2 v2.3.2` as dependencies. Only 
`pkg/adapter/mcpserver/registry/nacos/` used v2; 5 other packages still used 
v1. The v1 SDK is outdated (2020) with known security issues and API 
incompatibilities.
   
   ## Changes
   
   ### Import path updates (all nacos-using files)
   All imports changed from `github.com/nacos-group/nacos-sdk-go/...` to 
`github.com/nacos-group/nacos-sdk-go/v2/...`
   
   ### Breaking API change: SubscribeCallback signature
   - **v1**: `func(services []model.SubscribeService, err error)` 
   - **v2**: `func(services []model.Instance, err error)`
   
   The `model.SubscribeService` type no longer exists in v2 — the callback 
receives `[]model.Instance` directly.
   
   ### Code simplifications
   - Removed `generateInstance()` helper functions (3 files) that converted 
`SubscribeService → Instance` — no longer needed since v2 callback provides 
`Instance` directly
   - Removed `fromSubscribeServiceToServiceInstance()` in springcloud/nacos.go, 
now using `fromInstanceToServiceInstance()` directly
   - Added `@@` group prefix stripping for `ServiceName` in springcloud 
callback (previously handled by the removed conversion function)
   - Removed references to `model.Instance.Valid` field (removed in v2 SDK)
   
   ### Test updates
   - Updated mock and test data from `SubscribeService` to `Instance` type
   - Added `ServerHealthy()` and `CloseClient()` methods to test mock to 
satisfy v2's `INamingClient` interface
   
   ### Dependency cleanup
   - `go.mod`: removed `github.com/nacos-group/nacos-sdk-go v1.1.3` direct 
dependency
   - `go.sum`: cleaned up v1 entries
   
   ## Files Modified (13 files, net -40 lines)
   
   | Category | File | Change |
   |----------|------|--------|
   | Import-only | `pkg/remote/nacos/client.go` | import paths → v2 |
   | Import-only | `pkg/configcenter/nacos_load.go` | import paths → v2 |
   | Import-only | `pkg/adapter/dubboregistry/registry/nacos/registry.go` | 
import paths → v2 |
   | Import-only | 
`pkg/adapter/dubboregistry/registry/nacos/application_listener.go` | import 
paths → v2 |
   | Import-only | 
`pkg/adapter/dubboregistry/registry/nacos/interface_listener.go` | import paths 
→ v2 |
   | Callback sig | `application_service_listener.go` | `[]SubscribeService` → 
`[]Instance`, remove `generateInstance()` |
   | Callback sig | `service_listener.go` | `[]SubscribeService` → 
`[]Instance`, remove `generateInstance()`, drop `.Valid` |
   | Callback sig | `listener.go` | `[]SubscribeService` → `[]Instance`, remove 
`generateInstance()`, drop `.Valid` |
   | Callback sig | `springcloud/nacos.go` | `[]SubscribeService` → 
`[]Instance`, remove `fromSubscribeServiceToServiceInstance()`, add `@@` prefix 
strip |
   | Tests | `listener_test.go` | Mock: `SubscribeService` → `Instance`, add 
`ServerHealthy()` + `CloseClient()` |
   | Deps | `go.mod` / `go.sum` | Removed v1.1.3 dependency |
   
   ## Verification
   
   - ✅ `go build ./...` — passes
   - ✅ `go vet ./...` — no warnings
   - ✅ `go mod tidy` — clean, only v2 remains
   - ✅ `go test ./pkg/adapter/llmregistry/registry/nacos/...` — all 8 tests pass
   - ✅ `go test ./pkg/adapter/mcpserver/registry/nacos/...` — passes
   - ✅ `go test ./pkg/configcenter/...` — passes
   - ✅ No remaining v1 imports in source code


-- 
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]

Reply via email to