Skip to content

refactor: remove config package dependency from dubbogo-cli sample generator#3217

Closed
CAICAIIs wants to merge 4 commits intoapache:developfrom
CAICAIIs:feature/remove-config-from-dubbogo-cli-sample-generator
Closed

refactor: remove config package dependency from dubbogo-cli sample generator#3217
CAICAIIs wants to merge 4 commits intoapache:developfrom
CAICAIIs:feature/remove-config-from-dubbogo-cli-sample-generator

Conversation

@CAICAIIs
Copy link
Contributor

Replace deprecated config.Load() pattern with direct server.NewServer() and client.NewClient() API in tools/dubbogo-cli/generator/sample.

Changes:

  • Remove config package imports from gen_client.go and gen_server.go
  • Replace config.SetConsumerService() with client.NewClient() + api.NewGreeterClient()
  • Replace config.SetProviderService() with server.NewServer() + api.RegisterGreeterServer()
  • Remove DUBBO_GO_CONFIG_PATH environment variable dependency
  • Disable YAML config file generation (gen_c_conf.go, gen_s_conf.go)
  • Use programmatic configuration via Go API options

This aligns with the config-free migration strategy and removes the dependency on the deprecated config package for code generation.

Description

Related: #3204

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

…nerator

Replace deprecated config.Load() pattern with direct server.NewServer()
and client.NewClient() API in tools/dubbogo-cli/generator/sample.

Changes:
- Remove config package imports from gen_client.go and gen_server.go
- Replace config.SetConsumerService() with client.NewClient() + api.NewGreeterClient()
- Replace config.SetProviderService() with server.NewServer() + api.RegisterGreeterServer()
- Remove DUBBO_GO_CONFIG_PATH environment variable dependency
- Disable YAML config file generation (gen_c_conf.go, gen_s_conf.go)
- Use programmatic configuration via Go API options

This aligns with the config-free migration strategy and removes
the dependency on the deprecated config package for code generation.

Related: apache#3204
Delete client and server config files (dubbogo.yaml) from the
testGenCode/template/newDemo directory. This aligns with the
config-free approach implemented in the sample generator.

- Removed go-client/conf/dubbogo.yaml
- Removed go-server/conf/dubbogo.yaml
- New Demo now only generates 6 files (no config files)

Fixes test failure: TestNewDemo expects 6 files instead of 8
Update go-client/cmd/client.go and go-server/cmd/server.go in
testGenCode/template/newDemo/ to match the new config-free approach:

- Replace config.SetConsumerService() + config.Load() with client.NewClient()
- Replace config.SetProviderService() + config.Load() with server.NewServer()
- Use api.NewGreeterClient(cli) instead of grpcGreeterImpl
- Use api.RegisterGreeterServer(srv, provider) instead of config registration
- Remove DUBBO_GO_CONFIG_PATH environment variable comments

This aligns the test templates with the generator implementation,
fixing the TestNewDemo test failure.

Related: apache#3204
@sonarqubecloud
Copy link

@CAICAIIs CAICAIIs closed this Feb 17, 2026
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.

1 participant