mochengqian opened a new pull request, #3294:
URL: https://github.com/apache/dubbo-go/pull/3294

   ### Description
   Fixes #3286(issue)
   
   ### Background
   
   Issue #3259 exposed a real interoperability problem around variadic Go RPC 
methods such as `args ...string` when they are used from generic invocation or 
cross-language scenarios.
   
   PR #3284 already addressed the short-term runtime compatibility path. This 
PR focuses on the long-term guidance side, so we can keep existing services 
compatible while discouraging new risky contracts from being introduced.
   
   The goal of this PR is not to hinder existing users or further tighten 
runtime behavior, but to identify risks as early as possible and provide a 
clearer migration path for new cross-language services.
   
   ### What this PR does
   
   This PR adds non-breaking guidance in three places:
   
   - Emit a registration-time warning when a service exports variadic RPC 
methods.
   - Add a lightweight `variadicrpccheck` tool to detect exported variadic RPC 
contracts in CI or local development.
   
   ### Runtime guidance
   
   A reusable helper was added in `common/rpc_service.go` to detect variadic 
RPC methods based on the existing `suiteMethod` export rules. This keeps the 
detection logic aligned with what Dubbo-go actually treats as exported RPC 
methods.
   
   During service registration, `server/server.go` now emits a warning if the 
service exposes variadic RPC methods. The warning is non-blocking and 
explicitly says:
   
   - existing variadic services remain supported
   - new cross-language or generic contracts should avoid `...T`
   - `[]T`, request structs, or Triple + Protobuf IDL are preferred for new 
contracts
   
   This warning path is shared by `Register(...)`, `RegisterService(...)`, and 
generated `Register<Service>Handler(...)` flows through the same registration 
path.
   
   ### Tooling guidance
   
   This PR adds `tools/variadicrpccheck`, a warning-only scanner built on 
`go/packages` + AST/type information.
   
   It scans exported service interfaces and exported service implementations 
for variadic RPC-style signatures, and prints file/line warnings with migration 
guidance.
   
   A few guardrails are included to keep the first version practical:
   - skip `*_test.go`
   - skip `*.pb.go`
   - skip `*.triple.go`
   - filter out option-style variadics such as `opts ...Option`
   
   The tool is wired into `make rpc-contract-check` and added to GitHub Actions 
after lint. It is guidance-only and always exits with `0`, so it will not block 
CI.
   
   ### Checklist
   - [ ] I confirm the target branch is `develop`
   - [ ] Code has passed local testing
   - [ ] I have added tests that prove my fix is effective or that my feature 
works
   


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