diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 61e691f9e..41cea8b10 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -62,8 +62,8 @@ jobs: - name: Install go ci lint run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.41.1 -# - name: Run Linter -# run: golangci-lint run --timeout=10m -v + - name: Run Linter + run: golangci-lint run --timeout=10m -v - name: License run: make -f build/Makefile license diff --git a/.run/filter/filter-tpslimit-client.run.xml b/.run/filter/filter-tpslimit-client.run.xml index f3717f78e..e785ddc3f 100644 --- a/.run/filter/filter-tpslimit-client.run.xml +++ b/.run/filter/filter-tpslimit-client.run.xml @@ -1,6 +1,6 @@ - - + + diff --git a/.run/filter/filter-tpslimit-server.run.xml b/.run/filter/filter-tpslimit-server.run.xml index a8bae88ce..6e9c3e0f1 100644 --- a/.run/filter/filter-tpslimit-server.run.xml +++ b/.run/filter/filter-tpslimit-server.run.xml @@ -1,9 +1,9 @@ - - + + - + diff --git a/.run/metrics-client.run.xml b/.run/metrics-client.run.xml new file mode 100644 index 000000000..c21685ba2 --- /dev/null +++ b/.run/metrics-client.run.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.run/metrics-go-server.run.xml b/.run/metrics-go-server.run.xml new file mode 100644 index 000000000..86be56fc8 --- /dev/null +++ b/.run/metrics-go-server.run.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.run/route/meshroute/meshroute-go-client.run.xml b/.run/route/meshroute/meshroute-go-client.run.xml index a3d60cf5e..06629f688 100644 --- a/.run/route/meshroute/meshroute-go-client.run.xml +++ b/.run/route/meshroute/meshroute-go-client.run.xml @@ -1,5 +1,5 @@ - + diff --git a/.run/route/meshroute/meshroute-go-server.run.xml b/.run/route/meshroute/meshroute-go-server.run.xml index c82db72c1..48c2cc849 100644 --- a/.run/route/meshroute/meshroute-go-server.run.xml +++ b/.run/route/meshroute/meshroute-go-server.run.xml @@ -1,5 +1,5 @@ - + diff --git a/config-api/configcenter/nacos/go-client/cmd/client.go b/config-api/configcenter/nacos/go-client/cmd/client.go index 6c63543da..23e956dad 100644 --- a/config-api/configcenter/nacos/go-client/cmd/client.go +++ b/config-api/configcenter/nacos/go-client/cmd/client.go @@ -39,7 +39,7 @@ dubbo: timeout: 3s address: 127.0.0.1:2181 consumer: - registryIDs: + registry-ids: - demoZK references: GreeterClientImpl: diff --git a/config-api/configcenter/nacos/go-server/cmd/server.go b/config-api/configcenter/nacos/go-server/cmd/server.go index 4afba8ee9..659c31cfe 100644 --- a/config-api/configcenter/nacos/go-server/cmd/server.go +++ b/config-api/configcenter/nacos/go-server/cmd/server.go @@ -44,11 +44,11 @@ dubbo: name: tri port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: GreeterProvider: - protocolIDs: triple + protocol-ids: triple interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java` type GreeterProvider struct { diff --git a/config-api/configcenter/zookeeper/go-client/cmd/client.go b/config-api/configcenter/zookeeper/go-client/cmd/client.go index cadde7a68..d0acd816c 100644 --- a/config-api/configcenter/zookeeper/go-client/cmd/client.go +++ b/config-api/configcenter/zookeeper/go-client/cmd/client.go @@ -39,7 +39,7 @@ dubbo: timeout: 3s address: 127.0.0.1:8848 consumer: - registryIDs: + registry-ids: - demoZK references: GreeterClientImpl: @@ -54,6 +54,9 @@ func main() { SetProtocol("zookeeper"). SetAddress("127.0.0.1:2181"). Build().GetDynamicConfiguration() + if err != nil { + panic(err) + } if err := dynamicConfig.PublishConfig("dubbo-go-samples-configcenter-zookeeper-client", "dubbogo", configCenterZKClientConfig); err != nil { panic(err) diff --git a/config-api/configcenter/zookeeper/go-server/cmd/server.go b/config-api/configcenter/zookeeper/go-server/cmd/server.go index e7ddcd269..5572d63f6 100644 --- a/config-api/configcenter/zookeeper/go-server/cmd/server.go +++ b/config-api/configcenter/zookeeper/go-server/cmd/server.go @@ -44,11 +44,11 @@ dubbo: name: tri port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: GreeterProvider: - protocolIDs: triple + protocol-ids: triple interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java` type GreeterProvider struct { diff --git a/configcenter/apollo/README.md b/configcenter/apollo/README.md index d4914a9b0..7451b3180 100644 --- a/configcenter/apollo/README.md +++ b/configcenter/apollo/README.md @@ -24,11 +24,11 @@ dubbo: name: "tri" port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: "greeterImpl": - protocolIDs: "triple" + protocol-ids: "triple" interface: "com.apache.dubbo.sample.basic.IGreeter" # must be compatible with grpc or dubbo-java ``` @@ -48,7 +48,7 @@ dubbo: timeout: "3s" address: "127.0.0.1:2181" consumer: - registryIDs: + registry-ids: - demoZK references: "greeterImpl": diff --git a/configcenter/apollo/README_zh.md b/configcenter/apollo/README_zh.md index 17ba30e2d..12165de77 100644 --- a/configcenter/apollo/README_zh.md +++ b/configcenter/apollo/README_zh.md @@ -25,11 +25,11 @@ dubbo: name: "tri" port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: "greeterImpl": - protocolIDs: "triple" + protocol-ids: "triple" interface: "com.apache.dubbo.sample.basic.IGreeter" # must be compatible with grpc or dubbo-java ``` @@ -49,7 +49,7 @@ dubbo: timeout: "3s" address: "127.0.0.1:2181" consumer: - registryIDs: + registry-ids: - demoZK references: "greeterImpl": diff --git a/configcenter/apollo/go-client/cmd/client.go b/configcenter/apollo/go-client/cmd/client.go index 2a57b2132..54a69c14f 100644 --- a/configcenter/apollo/go-client/cmd/client.go +++ b/configcenter/apollo/go-client/cmd/client.go @@ -39,7 +39,9 @@ func init() { // export DUBBO_GO_CONFIG_PATH= PATH_TO_SAMPLES/helloworld/go-client/conf/dubbogo.yml func main() { - config.Load() + if err := config.Load(); err != nil { + panic(err) + } logger.Info("start to test dubbo") req := &api.HelloRequest{ diff --git a/configcenter/apollo/go-server/cmd/server.go b/configcenter/apollo/go-server/cmd/server.go index 7e5497433..ff49ef6de 100644 --- a/configcenter/apollo/go-server/cmd/server.go +++ b/configcenter/apollo/go-server/cmd/server.go @@ -62,7 +62,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) diff --git a/configcenter/nacos/go-client/cmd/client.go b/configcenter/nacos/go-client/cmd/client.go index 2a57b2132..54a69c14f 100644 --- a/configcenter/nacos/go-client/cmd/client.go +++ b/configcenter/nacos/go-client/cmd/client.go @@ -39,7 +39,9 @@ func init() { // export DUBBO_GO_CONFIG_PATH= PATH_TO_SAMPLES/helloworld/go-client/conf/dubbogo.yml func main() { - config.Load() + if err := config.Load(); err != nil { + panic(err) + } logger.Info("start to test dubbo") req := &api.HelloRequest{ diff --git a/configcenter/nacos/go-client/conf/dubbogo.yml b/configcenter/nacos/go-client/conf/dubbogo.yml index 684d90e20..9fb5f07a3 100644 --- a/configcenter/nacos/go-client/conf/dubbogo.yml +++ b/configcenter/nacos/go-client/conf/dubbogo.yml @@ -12,7 +12,7 @@ dubbo: # timeout: 3s # address: 127.0.0.1:2181 # consumer: -# registryIDs: +# registry-ids: # - demoZK # references: # GreeterClientImpl: diff --git a/configcenter/nacos/go-server/conf/dubbogo.yml b/configcenter/nacos/go-server/conf/dubbogo.yml index 7b1fd777c..058514c76 100644 --- a/configcenter/nacos/go-server/conf/dubbogo.yml +++ b/configcenter/nacos/go-server/conf/dubbogo.yml @@ -16,7 +16,7 @@ dubbo: # name: "tri" # port: 20000 # provider: -# registryIDs: +# registry-ids: # - demoZK # services: # GreeterProvider: diff --git a/configcenter/zookeeper/go-client/cmd/client.go b/configcenter/zookeeper/go-client/cmd/client.go index 2a57b2132..54a69c14f 100644 --- a/configcenter/zookeeper/go-client/cmd/client.go +++ b/configcenter/zookeeper/go-client/cmd/client.go @@ -39,7 +39,9 @@ func init() { // export DUBBO_GO_CONFIG_PATH= PATH_TO_SAMPLES/helloworld/go-client/conf/dubbogo.yml func main() { - config.Load() + if err := config.Load(); err != nil { + panic(err) + } logger.Info("start to test dubbo") req := &api.HelloRequest{ diff --git a/configcenter/zookeeper/go-client/conf/dubbogo.yml b/configcenter/zookeeper/go-client/conf/dubbogo.yml index c59b243ae..bf9d58486 100644 --- a/configcenter/zookeeper/go-client/conf/dubbogo.yml +++ b/configcenter/zookeeper/go-client/conf/dubbogo.yml @@ -12,7 +12,7 @@ dubbo: # timeout: 3s # address: 127.0.0.1:2181 # consumer: -# registryIDs: +# registry-ids: # - demoZK # references: # GreeterClientImpl: diff --git a/configcenter/zookeeper/go-server/conf/dubbogo.yml b/configcenter/zookeeper/go-server/conf/dubbogo.yml index 627b48d13..dde301c26 100644 --- a/configcenter/zookeeper/go-server/conf/dubbogo.yml +++ b/configcenter/zookeeper/go-server/conf/dubbogo.yml @@ -16,7 +16,7 @@ dubbo: # name: "tri" # port: 20000 # provider: -# registryIDs: +# registry-ids: # - demoZK # services: # GreeterProvider: diff --git a/context/dubbo/go-client/cmd/client.go b/context/dubbo/go-client/cmd/client.go index ede8b29b5..72de0cfaf 100644 --- a/context/dubbo/go-client/cmd/client.go +++ b/context/dubbo/go-client/cmd/client.go @@ -56,7 +56,9 @@ func main() { var userProvider = &UserProvider{} config.SetConsumerService(userProvider) hessian.RegisterPOJO(&ContextContent{}) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } gxlog.CInfo("\n\n\nstart to test dubbo") atta := make(map[string]interface{}) diff --git a/context/dubbo/go-client/conf/dubbogo.yml b/context/dubbo/go-client/conf/dubbogo.yml index 249b61539..9f67a58a8 100644 --- a/context/dubbo/go-client/conf/dubbogo.yml +++ b/context/dubbo/go-client/conf/dubbogo.yml @@ -29,7 +29,7 @@ dubbo: max-msg-len: 1024000 session-name: client consumer: - registryIDs: + registry-ids: - demoZK references: UserProvider: diff --git a/context/dubbo/go-server/cmd/server.go b/context/dubbo/go-server/cmd/server.go index 9f1feaf62..517b89d3a 100644 --- a/context/dubbo/go-server/cmd/server.go +++ b/context/dubbo/go-server/cmd/server.go @@ -94,7 +94,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) diff --git a/context/dubbo/go-server/conf/dubbogo.yml b/context/dubbo/go-server/conf/dubbogo.yml index 36ff0214f..1652ef818 100644 --- a/context/dubbo/go-server/conf/dubbogo.yml +++ b/context/dubbo/go-server/conf/dubbogo.yml @@ -25,7 +25,7 @@ dubbo: max-msg-len: 1024000 session-name: server provider: - registryIDs: + registry-ids: - demoZK services: UserProvider: diff --git a/context/triple/go-client/cmd/client.go b/context/triple/go-client/cmd/client.go index ca7f1fdad..af3601ab6 100644 --- a/context/triple/go-client/cmd/client.go +++ b/context/triple/go-client/cmd/client.go @@ -41,7 +41,10 @@ func init() { // export DUBBO_GO_CONFIG_PATH= PATH_TO_SAMPLES/helloworld/go-client/conf/dubbogo.yml func main() { - config.Load() + err := config.Load() + if err != nil { + panic(err) + } logger.Info("start to test dubbo") req := &api.HelloRequest{ diff --git a/context/triple/go-client/conf/dubbogo.yml b/context/triple/go-client/conf/dubbogo.yml index 59498477c..cf11a8414 100644 --- a/context/triple/go-client/conf/dubbogo.yml +++ b/context/triple/go-client/conf/dubbogo.yml @@ -5,7 +5,7 @@ dubbo: timeout: 3s address: 127.0.0.1:2181 consumer: - registryIDs: + registry-ids: - demoZK references: GreeterClientImpl: diff --git a/context/triple/go-server/conf/dubbogo.yml b/context/triple/go-server/conf/dubbogo.yml index b59f564e1..69879043f 100644 --- a/context/triple/go-server/conf/dubbogo.yml +++ b/context/triple/go-server/conf/dubbogo.yml @@ -9,9 +9,9 @@ dubbo: name: tri port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: GreeterProvider: - protocolIDs: triple + protocol-ids: triple interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java \ No newline at end of file diff --git a/direct/README.md b/direct/README.md index 4983fe5cc..e5decc301 100644 --- a/direct/README.md +++ b/direct/README.md @@ -33,7 +33,7 @@ Direct example code description: ```yaml services: "UserProvider": - registryIDs: "demoZk" + registry-ids: "demoZk" protocol : "dubbo" interface : "org.apache.dubbo.UserProvider" loadbalance: "random" @@ -67,7 +67,7 @@ initSignal() func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) @@ -112,7 +112,7 @@ application: environment: "dev" references: "UserProvider": - registryIDs: "demoZk" + registry-ids: "demoZk" protocol: "dubbo" interface: "org.apache.dubbo.UserProvider" cluster: "failover" diff --git a/direct/README_zh.md b/direct/README_zh.md index 5db1cc9c2..ca89ce52b 100644 --- a/direct/README_zh.md +++ b/direct/README_zh.md @@ -36,7 +36,7 @@ ```yaml services: "UserProvider": - registryIDs: "demoZk" + registry-ids: "demoZk" protocol : "dubbo" interface : "org.apache.dubbo.UserProvider" loadbalance: "random" @@ -70,7 +70,7 @@ initSignal() func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrup, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) @@ -115,7 +115,7 @@ application: environment: "dev" references: "UserProvider": - registryIDs: "demoZk" + registry-ids: "demoZk" protocol: "dubbo" interface: "org.apache.dubbo.UserProvider" cluster: "failover" diff --git a/direct/go-server/conf/dubbogo.yml b/direct/go-server/conf/dubbogo.yml index e1f437315..a0f98199e 100644 --- a/direct/go-server/conf/dubbogo.yml +++ b/direct/go-server/conf/dubbogo.yml @@ -6,5 +6,5 @@ dubbo: provider: services: GreeterProvider: - protocolIDs: triple + protocol-ids: triple interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java \ No newline at end of file diff --git a/filter/custom/go-client/conf/dubbogo.yml b/filter/custom/go-client/conf/dubbogo.yml index e2493db6d..813db82e1 100644 --- a/filter/custom/go-client/conf/dubbogo.yml +++ b/filter/custom/go-client/conf/dubbogo.yml @@ -11,7 +11,7 @@ dubbo: check: true request_timeout: 3s connect_timeout: 3s - registryIDs: + registry-ids: - demoZK references: GreeterClientImpl: diff --git a/filter/custom/go-server/conf/dubbogo.yml b/filter/custom/go-server/conf/dubbogo.yml index a2206796f..6f8af7b07 100644 --- a/filter/custom/go-server/conf/dubbogo.yml +++ b/filter/custom/go-server/conf/dubbogo.yml @@ -9,12 +9,12 @@ dubbo: name: tri port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: GreeterProvider: filter: myServerFilter - protocolIDs: tripleProtocol + protocol-ids: tripleProtocol interface: org.apache.dubbo.UserProvider loadbalance: random warmup: 100 diff --git a/filter/tpslimit/go-client/conf/dubbogo.yml b/filter/tpslimit/go-client/conf/dubbogo.yml index 7b72cbf61..df5c47d37 100644 --- a/filter/tpslimit/go-client/conf/dubbogo.yml +++ b/filter/tpslimit/go-client/conf/dubbogo.yml @@ -10,7 +10,7 @@ dubbo: check: true request_timeout: 3s connect_timeout: 3s - registryIDs: + registry-ids: - demoZK references: UserProvider: diff --git a/filter/tpslimit/go-server/cmd/server.go b/filter/tpslimit/go-server/cmd/server.go index 21243ab67..ff711346a 100644 --- a/filter/tpslimit/go-server/cmd/server.go +++ b/filter/tpslimit/go-server/cmd/server.go @@ -44,14 +44,17 @@ var ( func main() { config.SetProviderService(new(pkg.UserProvider)) hessian.RegisterPOJO(&pkg.User{}) - config.Load() + err := config.Load() + if err != nil { + panic(err) + } initSignal() } func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) diff --git a/filter/tpslimit/go-server/conf/dubbogo.yml b/filter/tpslimit/go-server/conf/dubbogo.yml index b48dc6b97..fc48fa915 100644 --- a/filter/tpslimit/go-server/conf/dubbogo.yml +++ b/filter/tpslimit/go-server/conf/dubbogo.yml @@ -12,7 +12,7 @@ dubbo: name: dubbo port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: UserProvider: diff --git a/game/go-server-game/cmd/server.go b/game/go-server-game/cmd/server.go index fd76bcf61..b569860a6 100644 --- a/game/go-server-game/cmd/server.go +++ b/game/go-server-game/cmd/server.go @@ -46,7 +46,10 @@ func init() { } func main() { - config.Load() + err := config.Load() + if err != nil { + panic(err) + } initSignal() } @@ -54,7 +57,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %#s", sig.String()) diff --git a/game/go-server-game/conf/dubbogo.yml b/game/go-server-game/conf/dubbogo.yml index c555f2361..6441204bc 100644 --- a/game/go-server-game/conf/dubbogo.yml +++ b/game/go-server-game/conf/dubbogo.yml @@ -5,7 +5,7 @@ dubbo: timeout: 3s address: 127.0.0.1:2181 consumer: - registryIDs: + registry-ids: - demoZK references: gateConsumer.basketballService: @@ -16,7 +16,7 @@ dubbo: - name: "Send" retries: 0 provider: - registryIDs: + registry-ids: - demoZK services: gameProvider.basketballService: diff --git a/game/go-server-gate/cmd/server.go b/game/go-server-gate/cmd/server.go index 4f49238c4..af36abf11 100644 --- a/game/go-server-gate/cmd/server.go +++ b/game/go-server-gate/cmd/server.go @@ -51,7 +51,10 @@ func init() { } func main() { - config.Load() + err := config.Load() + if err != nil { + panic(err) + } go startHttp() @@ -61,7 +64,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) @@ -104,7 +107,11 @@ func startHttp() { logger.Error(err.Error()) } var info pojo.Info - json.Unmarshal(reqBody, &info) + err = json.Unmarshal(reqBody, &info) + if err != nil { + responseWithOrigin(w, r, 500, []byte(err.Error())) + return + } res, err := pkg.Score(context.TODO(), info.Name, strconv.Itoa(info.Score)) if err != nil { responseWithOrigin(w, r, 200, []byte(err.Error())) @@ -145,5 +152,8 @@ func responseWithOrigin(w http.ResponseWriter, r *http.Request, code int, json [ w.Header().Set("Access-Control-Allow-Credentials", "true") w.Header().Set("Content-Type", "application/json; charset=utf-8") w.WriteHeader(code) - w.Write(json) + _, err := w.Write(json) + if err != nil { + panic(err) + } } diff --git a/game/go-server-gate/conf/dubbogo.yml b/game/go-server-gate/conf/dubbogo.yml index 9687c5afd..d2bb08fdd 100644 --- a/game/go-server-gate/conf/dubbogo.yml +++ b/game/go-server-gate/conf/dubbogo.yml @@ -5,14 +5,14 @@ dubbo: timeout: 3s address: 127.0.0.1:2181 consumer: - registryIDs: + registry-ids: - demoZK references: gameConsumer.basketballService: protocol: dubbo interface: org.apache.dubbo.game.basketballService cluster: "failover" - registryIDs: + registry-ids: - demoZK methods: - name: "Online" @@ -22,7 +22,7 @@ dubbo: - name: "Message" retries: 0 provider: - registryIDs: + registry-ids: - demoZK services: gateProvider.basketballService: diff --git a/generic/default/go-client/cmd/client.go b/generic/default/go-client/cmd/client.go index 31107c5ad..dda772b29 100644 --- a/generic/default/go-client/cmd/client.go +++ b/generic/default/go-client/cmd/client.go @@ -115,6 +115,7 @@ func callGetUser(refConf config.ReferenceConfig) { logger.Infof("GetUser4(userCode int, name string) res: %+v", resp) } +// nolint func callGetOneUser(refConf config.ReferenceConfig) { resp, err := refConf.GetRPCService().(*generic.GenericService).Invoke( context.TODO(), @@ -219,6 +220,7 @@ func callQueryUsers(refConf config.ReferenceConfig) { logger.Infof("queryUsers(users []*User) res: %+v", resp) } +// nolint func callQueryAll(refConf config.ReferenceConfig) { resp, err := refConf.GetRPCService().(*generic.GenericService).Invoke( context.TODO(), diff --git a/generic/default/go-server/cmd/server.go b/generic/default/go-server/cmd/server.go index 5a7e05d85..29bdbc8ad 100644 --- a/generic/default/go-server/cmd/server.go +++ b/generic/default/go-server/cmd/server.go @@ -50,7 +50,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, + signal.Notify(signals, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals diff --git a/generic/default/go-server/conf/dubbogo.yml b/generic/default/go-server/conf/dubbogo.yml index d3b842ea7..af51a43a1 100644 --- a/generic/default/go-server/conf/dubbogo.yml +++ b/generic/default/go-server/conf/dubbogo.yml @@ -12,12 +12,12 @@ dubbo: name: tri port: 20001 provider: - registryIDs: zk + registry-ids: zk services: UserProvider: - protocolIDs: dubbo + protocol-ids: dubbo interface: org.apache.dubbo.samples.UserProvider UserProviderTriple: - protocolIDs: triple + protocol-ids: triple serialization: hessian2 interface: org.apache.dubbo.samples.UserProviderTriple \ No newline at end of file diff --git a/go.mod b/go.mod index bc8090629..b57125b03 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ module github.com/apache/dubbo-go-samples require ( - dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20211025072335-e5519450e07f + dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20211027072544-4d4fb6ed2f6c github.com/apache/dubbo-go-hessian2 v1.9.4-0.20210917102639-74a8ece5f3cb - github.com/dubbogo/gost v1.11.18 + github.com/dubbogo/gost v1.11.19 github.com/dubbogo/net v0.0.4 github.com/dubbogo/triple v1.0.8 github.com/golang/protobuf v1.5.2 diff --git a/go.sum b/go.sum index 1a1dc39f6..7d50cd5c8 100644 --- a/go.sum +++ b/go.sum @@ -32,9 +32,11 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +contrib.go.opencensus.io/exporter/prometheus v0.4.0 h1:0QfIkj9z/iVZgK31D9H9ohjjIDApI2GOPScCKwxedbs= +contrib.go.opencensus.io/exporter/prometheus v0.4.0/go.mod h1:o7cosnyfuPVK0tB8q0QmaQNhGnptITnPQB+z1+qeFB0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20211025072335-e5519450e07f h1:BABYh/iddWO9oCcq+NaOoRIiLdU1GMxlRkS8/3Wx8RI= -dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20211025072335-e5519450e07f/go.mod h1:CNgt1+bui3uWepjoOOi4PVsuf6ZDQZLu0V8sWY02jT0= +dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20211027072544-4d4fb6ed2f6c h1:GyKAO86EcK7+1i9oPE1/SyfgvjCdeEP0YsydlPi/wBc= +dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20211027072544-4d4fb6ed2f6c/go.mod h1:caCkQ4jw6tphBSP+NEd2/EZGOXK71VoD9yyw8qPpYxo= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= @@ -96,6 +98,16 @@ github.com/aws/aws-sdk-go v1.25.37/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpi github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.30.27/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= +github.com/aws/aws-sdk-go-v2/config v1.8.3/go.mod h1:4AEiLtAb8kLs7vgw2ZV3p2VZ1+hBavOc84hqxVNpCyw= +github.com/aws/aws-sdk-go-v2/credentials v1.4.3/go.mod h1:FNNC6nQZQUuyhq5aE5c7ata8o9e4ECGmS4lAXC7o1mQ= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.6.0/go.mod h1:gqlclDEZp4aqJOancXK6TN24aKhT0W0Ae9MHk3wzTMM= +github.com/aws/aws-sdk-go-v2/internal/ini v1.2.4/go.mod h1:ZcBrrI3zBKlhGFNYWvju0I3TR93I7YIgAfy82Fh4lcQ= +github.com/aws/aws-sdk-go-v2/service/appconfig v1.4.2/go.mod h1:FZ3HkCe+b10uFZZkFdvf98LHW21k49W8o8J366lqVKY= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.3.2/go.mod h1:72HRZDLMtmVQiLG2tLfQcaWLCssELvGl+Zf2WVxMmR8= +github.com/aws/aws-sdk-go-v2/service/sso v1.4.2/go.mod h1:NBvT9R1MEF+Ud6ApJKM0G+IkPchKS7p7c2YPKwHmBOk= +github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g= +github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -181,8 +193,9 @@ github.com/dubbogo/go-zookeeper v1.0.3 h1:UkuY+rBsxdT7Bs63QAzp9z7XqQ53W1j8E5rwl8 github.com/dubbogo/go-zookeeper v1.0.3/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c= github.com/dubbogo/gost v1.9.0/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8= github.com/dubbogo/gost v1.11.12/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZTy/61jI= -github.com/dubbogo/gost v1.11.18 h1:e9WRvDQut6cePYcQEOUC15vGSfftO7q9G2+Vw2s4CHE= github.com/dubbogo/gost v1.11.18/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZTy/61jI= +github.com/dubbogo/gost v1.11.19 h1:R1rZ3TNJKV9W5XHLMv+GDO2Wy6UDnwGQtVWbsWYvo0A= +github.com/dubbogo/gost v1.11.19/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZTy/61jI= github.com/dubbogo/jsonparser v1.0.1/go.mod h1:tYAtpctvSP/tWw4MeelsowSPgXQRVHHWbqL6ynps8jU= github.com/dubbogo/net v0.0.4 h1:Rn9aMPZwOiRE22YhtxmDEE3H0Q3cfVRNhuEjNMelJ/8= github.com/dubbogo/net v0.0.4/go.mod h1:1CGOnM7X3he+qgGNqjeADuE5vKZQx/eMSeUkpU3ujIc= @@ -243,12 +256,14 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-kit/log v0.1.0 h1:DGJh0Sm43HbOeYDNnVZFl8BvcYVvjD5bqYJvp0REbwQ= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= github.com/go-ldap/ldap/v3 v3.1.3/go.mod h1:3rbOH3jRS2u6jg2rJnKAMLE/xQyCKIveG2Sa/Cohzb8= github.com/go-ldap/ldap/v3 v3.1.10/go.mod h1:5Zun81jBTabRaI8lzN7E1JjyEl1g6zI6u9pd8luAK4Q= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= @@ -269,6 +284,7 @@ github.com/go-resty/resty/v2 v2.3.0 h1:JOOeAvjSlapTT92p8xiS19Zxev1neGikoHsXJeOq8 github.com/go-resty/resty/v2 v2.3.0/go.mod h1:UpN9CgLZNsv4e9XG50UU8xdI0F43UQ4HmxLBDwaroHU= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= @@ -331,9 +347,11 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -444,8 +462,11 @@ github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj github.com/jinzhu/copier v0.3.2 h1:QdBOCbaouLDYaIPFfi1bKv5F5tPpeTwXe4sD0jqtz5w= github.com/jinzhu/copier v0.3.2/go.mod h1:24xnZezI2Yqac9J61UC6/dG/k76ttpq0DdJI3QmUvro= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.3.0 h1:OS12ieG61fsCg5+qLJ+SsW9NicxNkg3b25OyT2yCeUc= github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= +github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= @@ -475,8 +496,8 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/knadh/koanf v1.2.4 h1:AQYoGbNwphHd63E//SkDkqEGcogARxGspHWqoJw6O8k= -github.com/knadh/koanf v1.2.4/go.mod h1:xpPTwMhsA/aaQLAilyCCqfpEiY1gpa160AiCuWHJUjY= +github.com/knadh/koanf v1.3.0 h1:nNmG4HGbpJUv7eUV1skDvHzzFS+35Q3b+OsYvoXyt2E= +github.com/knadh/koanf v1.3.0/go.mod h1:HZ7HMLIGbrWJUfgtEzfHvzR/rX+eIqQlBNPRr4Vt42s= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -668,6 +689,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/statsd_exporter v0.21.0 h1:hA05Q5RFeIjgwKIYEdFd59xu5Wwaznf33yKI+pyX6T8= +github.com/prometheus/statsd_exporter v0.21.0/go.mod h1:rbT83sZq2V+p73lHhPZfMc3MLCHmSHelCh9hSGYNLTQ= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA= @@ -807,6 +830,8 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -920,6 +945,7 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= @@ -1176,6 +1202,7 @@ google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= diff --git a/helloworld/go-client/conf/dubbogo.yml b/helloworld/go-client/conf/dubbogo.yml index 59498477c..cf11a8414 100644 --- a/helloworld/go-client/conf/dubbogo.yml +++ b/helloworld/go-client/conf/dubbogo.yml @@ -5,7 +5,7 @@ dubbo: timeout: 3s address: 127.0.0.1:2181 consumer: - registryIDs: + registry-ids: - demoZK references: GreeterClientImpl: diff --git a/helloworld/go-server/conf/dubbogo.yml b/helloworld/go-server/conf/dubbogo.yml index b59f564e1..69879043f 100644 --- a/helloworld/go-server/conf/dubbogo.yml +++ b/helloworld/go-server/conf/dubbogo.yml @@ -9,9 +9,9 @@ dubbo: name: tri port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: GreeterProvider: - protocolIDs: triple + protocol-ids: triple interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java \ No newline at end of file diff --git a/integrate_test/config-api/configcenter/nacos/tests/integration/config-api-center-nacos_test.go b/integrate_test/config-api/configcenter/nacos/tests/integration/config-api-center-nacos_test.go index 971a8a806..0a186a485 100644 --- a/integrate_test/config-api/configcenter/nacos/tests/integration/config-api-center-nacos_test.go +++ b/integrate_test/config-api/configcenter/nacos/tests/integration/config-api-center-nacos_test.go @@ -35,8 +35,6 @@ func TestSayHello(t *testing.T) { Name: "laurence", } - reply := &dubbo3pb.User{} - ctx := context.Background() reply, err := greeterProvider.SayHello(ctx, req) diff --git a/integrate_test/config-api/configcenter/zookeeper/tests/integration/config-api-center-zk_test.go b/integrate_test/config-api/configcenter/zookeeper/tests/integration/config-api-center-zk_test.go index 971a8a806..0a186a485 100644 --- a/integrate_test/config-api/configcenter/zookeeper/tests/integration/config-api-center-zk_test.go +++ b/integrate_test/config-api/configcenter/zookeeper/tests/integration/config-api-center-zk_test.go @@ -35,8 +35,6 @@ func TestSayHello(t *testing.T) { Name: "laurence", } - reply := &dubbo3pb.User{} - ctx := context.Background() reply, err := greeterProvider.SayHello(ctx, req) diff --git a/integrate_test/configcenter/apollo/tests/integration/main_test.go b/integrate_test/configcenter/apollo/tests/integration/main_test.go index 8e8355b9f..d031191f4 100644 --- a/integrate_test/configcenter/apollo/tests/integration/main_test.go +++ b/integrate_test/configcenter/apollo/tests/integration/main_test.go @@ -35,7 +35,10 @@ var greeterProvider = new(dubbo3pb.GreeterClientImpl) func TestMain(m *testing.M) { config.SetConsumerService(greeterProvider) - config.Load() + err := config.Load() + if err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/configcenter/nacos/tests/integration/main_test.go b/integrate_test/configcenter/nacos/tests/integration/main_test.go index fdb84904f..d6d41a7b9 100644 --- a/integrate_test/configcenter/nacos/tests/integration/main_test.go +++ b/integrate_test/configcenter/nacos/tests/integration/main_test.go @@ -36,7 +36,9 @@ var userProvider = new(UserProvider) func TestMain(m *testing.M) { config.SetConsumerService(userProvider) hessian.RegisterPOJO(&User{}) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/context/dubbo/tests/integration/main_test.go b/integrate_test/context/dubbo/tests/integration/main_test.go index c7a69938d..f1b35d596 100644 --- a/integrate_test/context/dubbo/tests/integration/main_test.go +++ b/integrate_test/context/dubbo/tests/integration/main_test.go @@ -35,7 +35,9 @@ var userProvider = new(UserProvider) func TestMain(m *testing.M) { config.SetConsumerService(userProvider) hessian.RegisterPOJO(&ContextContent{}) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/context/dubbo/tests/integration/userprovider_test.go b/integrate_test/context/dubbo/tests/integration/userprovider_test.go index 18417f031..4ce6c73fa 100644 --- a/integrate_test/context/dubbo/tests/integration/userprovider_test.go +++ b/integrate_test/context/dubbo/tests/integration/userprovider_test.go @@ -29,8 +29,6 @@ import ( ) func TestGetUser(t *testing.T) { - rspContext := &ContextContent{} - // add field that client wants to send atta := make(map[string]interface{}) atta["string-value"] = "string-demo" diff --git a/integrate_test/direct/tests/integration/main_test.go b/integrate_test/direct/tests/integration/main_test.go index 8e8355b9f..d031191f4 100644 --- a/integrate_test/direct/tests/integration/main_test.go +++ b/integrate_test/direct/tests/integration/main_test.go @@ -35,7 +35,10 @@ var greeterProvider = new(dubbo3pb.GreeterClientImpl) func TestMain(m *testing.M) { config.SetConsumerService(greeterProvider) - config.Load() + err := config.Load() + if err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/direct/tests/integration/userprovider_test.go b/integrate_test/direct/tests/integration/userprovider_test.go index 971a8a806..0a186a485 100644 --- a/integrate_test/direct/tests/integration/userprovider_test.go +++ b/integrate_test/direct/tests/integration/userprovider_test.go @@ -35,8 +35,6 @@ func TestSayHello(t *testing.T) { Name: "laurence", } - reply := &dubbo3pb.User{} - ctx := context.Background() reply, err := greeterProvider.SayHello(ctx, req) diff --git a/integrate_test/filter/custom/tests/integration/main_test.go b/integrate_test/filter/custom/tests/integration/main_test.go index 89b56dfbe..2a7a2f4c8 100644 --- a/integrate_test/filter/custom/tests/integration/main_test.go +++ b/integrate_test/filter/custom/tests/integration/main_test.go @@ -35,7 +35,9 @@ var userProvider = &api.GreeterClientImpl{} func TestMain(m *testing.M) { config.SetConsumerService(userProvider) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/game/go-server-game/tests/integration/main_test.go b/integrate_test/game/go-server-game/tests/integration/main_test.go index 72c7295be..5ff6c874a 100644 --- a/integrate_test/game/go-server-game/tests/integration/main_test.go +++ b/integrate_test/game/go-server-game/tests/integration/main_test.go @@ -40,7 +40,10 @@ func TestMain(m *testing.M) { config.SetConsumerService(gameProvider) hessian.RegisterPOJO(&pojo.Result{}) - config.Load() + err := config.Load() + if err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/game/go-server-gate/tests/integration/main_test.go b/integrate_test/game/go-server-gate/tests/integration/main_test.go index 489907853..b720e21f3 100644 --- a/integrate_test/game/go-server-gate/tests/integration/main_test.go +++ b/integrate_test/game/go-server-gate/tests/integration/main_test.go @@ -40,7 +40,9 @@ func TestMain(m *testing.M) { config.SetConsumerService(gateProvider) hessian.RegisterPOJO(&pojo.Result{}) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/generic/default/tests/integration/userprovider_test.go b/integrate_test/generic/default/tests/integration/userprovider_test.go index 563f60e5e..0ce0103e3 100644 --- a/integrate_test/generic/default/tests/integration/userprovider_test.go +++ b/integrate_test/generic/default/tests/integration/userprovider_test.go @@ -39,7 +39,7 @@ func TestGetUser1(t *testing.T) { []hessian.Object{"A003"}, ) assert.Nil(t, err) - assert.IsType(t, make(map[interface{}]interface{}, 0), o) + assert.IsType(t, make(map[interface{}]interface{}), o) resp := o.(map[interface{}]interface{}) assert.Equal(t, "Joe", resp["name"]) assert.Equal(t, int32(48), resp["age"]) @@ -52,7 +52,7 @@ func TestGetUser1(t *testing.T) { []hessian.Object{"A003"}, ) assert.Nil(t, err) - assert.IsType(t, make(map[interface{}]interface{}, 0), o) + assert.IsType(t, make(map[interface{}]interface{}), o) resp = o.(map[interface{}]interface{}) assert.Equal(t, "Joe", resp["name"]) assert.Equal(t, int32(48), resp["age"]) @@ -67,7 +67,7 @@ func TestGetUser2(t *testing.T) { []hessian.Object{"A003", "lily"}, ) assert.Nil(t, err) - assert.IsType(t, make(map[interface{}]interface{}, 0), o) + assert.IsType(t, make(map[interface{}]interface{}), o) resp := o.(map[interface{}]interface{}) assert.Equal(t, "lily", resp["name"]) assert.Equal(t, int32(48), resp["age"]) @@ -80,7 +80,7 @@ func TestGetUser2(t *testing.T) { []hessian.Object{"A003", "lily"}, ) assert.Nil(t, err) - assert.IsType(t, make(map[interface{}]interface{}, 0), o) + assert.IsType(t, make(map[interface{}]interface{}), o) resp = o.(map[interface{}]interface{}) assert.Equal(t, "lily", resp["name"]) assert.Equal(t, int32(48), resp["age"]) @@ -95,7 +95,7 @@ func TestGetUser3(t *testing.T) { []hessian.Object{1}, ) assert.Nil(t, err) - assert.IsType(t, make(map[interface{}]interface{}, 0), o) + assert.IsType(t, make(map[interface{}]interface{}), o) resp := o.(map[interface{}]interface{}) assert.Equal(t, "Alex Stocks", resp["name"]) assert.Equal(t, int32(18), resp["age"]) @@ -108,7 +108,7 @@ func TestGetUser3(t *testing.T) { []hessian.Object{1}, ) assert.Nil(t, err) - assert.IsType(t, make(map[interface{}]interface{}, 0), o) + assert.IsType(t, make(map[interface{}]interface{}), o) resp = o.(map[interface{}]interface{}) assert.Equal(t, "Alex Stocks", resp["name"]) assert.Equal(t, int32(18), resp["age"]) @@ -123,7 +123,7 @@ func TestGetUser4(t *testing.T) { []hessian.Object{1, "zhangsan"}, ) assert.Nil(t, err) - assert.IsType(t, make(map[interface{}]interface{}, 0), o) + assert.IsType(t, make(map[interface{}]interface{}), o) resp := o.(map[interface{}]interface{}) assert.Equal(t, "zhangsan", resp["name"]) assert.Equal(t, int32(18), resp["age"]) @@ -136,7 +136,7 @@ func TestGetUser4(t *testing.T) { []hessian.Object{1, "zhangsan"}, ) assert.Nil(t, err) - assert.IsType(t, make(map[interface{}]interface{}, 0), o) + assert.IsType(t, make(map[interface{}]interface{}), o) resp = o.(map[interface{}]interface{}) assert.Equal(t, "zhangsan", resp["name"]) assert.Equal(t, int32(18), resp["age"]) @@ -173,7 +173,7 @@ func TestGetUsers(t *testing.T) { }, ) assert.Nil(t, err) - assert.IsType(t, make(map[interface{}]interface{}, 0), o) + assert.IsType(t, make(map[interface{}]interface{}), o) resp := o.(map[interface{}]interface{}) assert.Equal(t, "other-zhangsan", resp["users"].([]interface{})[0].(map[interface{}]interface{})["name"]) assert.Equal(t, "other-lisi", resp["users"].([]interface{})[1].(map[interface{}]interface{})["name"]) @@ -191,7 +191,7 @@ func TestGetUsers(t *testing.T) { }, ) assert.Nil(t, err) - assert.IsType(t, make(map[interface{}]interface{}, 0), o) + assert.IsType(t, make(map[interface{}]interface{}), o) resp = o.(map[interface{}]interface{}) assert.Equal(t, "other-zhangsan", resp["users"].([]interface{})[0].(map[interface{}]interface{})["name"]) assert.Equal(t, "other-lisi", resp["users"].([]interface{})[1].(map[interface{}]interface{})["name"]) @@ -213,7 +213,7 @@ func TestQueryUser(t *testing.T) { ) assert.Nil(t, err) - assert.IsType(t, make(map[interface{}]interface{}, 0), o) + assert.IsType(t, make(map[interface{}]interface{}), o) resp := o.(map[interface{}]interface{}) assert.Equal(t, "panty", resp["name"]) assert.Equal(t, int32(25), resp["age"]) @@ -232,7 +232,7 @@ func TestQueryUser(t *testing.T) { ) assert.Nil(t, err) - assert.IsType(t, make(map[interface{}]interface{}, 0), o) + assert.IsType(t, make(map[interface{}]interface{}), o) resp = o.(map[interface{}]interface{}) assert.Equal(t, "panty", resp["name"]) assert.Equal(t, int32(25), resp["age"]) diff --git a/integrate_test/helloworld/tests/integration/helloworld_test.go b/integrate_test/helloworld/tests/integration/helloworld_test.go index 971a8a806..0a186a485 100644 --- a/integrate_test/helloworld/tests/integration/helloworld_test.go +++ b/integrate_test/helloworld/tests/integration/helloworld_test.go @@ -35,8 +35,6 @@ func TestSayHello(t *testing.T) { Name: "laurence", } - reply := &dubbo3pb.User{} - ctx := context.Background() reply, err := greeterProvider.SayHello(ctx, req) diff --git a/integrate_test/helloworld/tests/integration/main_test.go b/integrate_test/helloworld/tests/integration/main_test.go index 8e8355b9f..8b44c8a60 100644 --- a/integrate_test/helloworld/tests/integration/main_test.go +++ b/integrate_test/helloworld/tests/integration/main_test.go @@ -35,7 +35,9 @@ var greeterProvider = new(dubbo3pb.GreeterClientImpl) func TestMain(m *testing.M) { config.SetConsumerService(greeterProvider) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/filter/tpslimit/go-server/tests/integration/userprovider_test.go b/integrate_test/metrics/tests/integration/helloworld_test.go similarity index 65% rename from filter/tpslimit/go-server/tests/integration/userprovider_test.go rename to integrate_test/metrics/tests/integration/helloworld_test.go index 50bd643a0..0a186a485 100644 --- a/filter/tpslimit/go-server/tests/integration/userprovider_test.go +++ b/integrate_test/metrics/tests/integration/helloworld_test.go @@ -1,5 +1,3 @@ -// +build integration - /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -21,7 +19,6 @@ package integration import ( "context" - "strings" "testing" ) @@ -29,22 +26,21 @@ import ( "github.com/stretchr/testify/assert" ) -func TestGetUser(t *testing.T) { - user := &User{} - var err error - - // loop 50 times to make sure rejection happens - for i := 0; i < 50; i++ { - if user, err = userProvider.GetUser(context.TODO(), "A001"); err != nil { - break - } +import ( + dubbo3pb "github.com/apache/dubbo-go-samples/api" +) - assert.Equal(t, "A001", user.ID) - assert.Equal(t, "Alex Stocks", user.Name) - assert.Equal(t, int32(18), user.Age) - assert.NotNil(t, user.Time) +func TestSayHello(t *testing.T) { + req := &dubbo3pb.HelloRequest{ + Name: "laurence", } - assert.NotNil(t, err) - assert.True(t, strings.Contains(err.Error(), "rejected")) + ctx := context.Background() + + reply, err := greeterProvider.SayHello(ctx, req) + + assert.Nil(t, err) + assert.Equal(t, "Hello laurence", reply.Name) + assert.Equal(t, "12345", reply.Id) + assert.Equal(t, int32(21), reply.Age) } diff --git a/filter/tpslimit/go-server/tests/integration/main_test.go b/integrate_test/metrics/tests/integration/main_test.go similarity index 67% rename from filter/tpslimit/go-server/tests/integration/main_test.go rename to integrate_test/metrics/tests/integration/main_test.go index 2f1acc200..d031191f4 100644 --- a/filter/tpslimit/go-server/tests/integration/main_test.go +++ b/integrate_test/metrics/tests/integration/main_test.go @@ -1,5 +1,3 @@ -// +build integration - /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -20,42 +18,27 @@ package integration import ( - "context" "os" "testing" - "time" ) import ( "dubbo.apache.org/dubbo-go/v3/config" _ "dubbo.apache.org/dubbo-go/v3/imports" +) - hessian "github.com/apache/dubbo-go-hessian2" +import ( + dubbo3pb "github.com/apache/dubbo-go-samples/api" ) -var userProvider = new(UserProvider) +var greeterProvider = new(dubbo3pb.GreeterClientImpl) func TestMain(m *testing.M) { - config.SetConsumerService(userProvider) - hessian.RegisterPOJO(&User{}) - config.Load() - - time.Sleep(3 * time.Second) + config.SetConsumerService(greeterProvider) + err := config.Load() + if err != nil { + panic(err) + } os.Exit(m.Run()) } - -type User struct { - ID string - Name string - Age int32 - Time time.Time -} - -type UserProvider struct { - GetUser func(ctx context.Context, req string) (*User, error) -} - -func (u *User) JavaClassName() string { - return "org.apache.dubbo.User" -} diff --git a/integrate_test/registry/etcd/tests/integration/main_test.go b/integrate_test/registry/etcd/tests/integration/main_test.go index 003b8305b..29c668aa5 100644 --- a/integrate_test/registry/etcd/tests/integration/main_test.go +++ b/integrate_test/registry/etcd/tests/integration/main_test.go @@ -41,7 +41,9 @@ var ( func TestMain(m *testing.M) { config.SetConsumerService(userProvider) hessian.RegisterPOJO(&pkg.User{}) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/registry/nacos/tests/integration/main_test.go b/integrate_test/registry/nacos/tests/integration/main_test.go index 29ad58a62..db24576fc 100644 --- a/integrate_test/registry/nacos/tests/integration/main_test.go +++ b/integrate_test/registry/nacos/tests/integration/main_test.go @@ -36,7 +36,9 @@ var userProvider = &UserProvider{} func TestMain(m *testing.M) { config.SetConsumerService(userProvider) hessian.RegisterPOJO(&User{}) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/registry/servicediscovery/nacos/tests/integration/helloworld_test.go b/integrate_test/registry/servicediscovery/nacos/tests/integration/helloworld_test.go index 971a8a806..0a186a485 100644 --- a/integrate_test/registry/servicediscovery/nacos/tests/integration/helloworld_test.go +++ b/integrate_test/registry/servicediscovery/nacos/tests/integration/helloworld_test.go @@ -35,8 +35,6 @@ func TestSayHello(t *testing.T) { Name: "laurence", } - reply := &dubbo3pb.User{} - ctx := context.Background() reply, err := greeterProvider.SayHello(ctx, req) diff --git a/integrate_test/registry/servicediscovery/nacos/tests/integration/main_test.go b/integrate_test/registry/servicediscovery/nacos/tests/integration/main_test.go index cbc239d15..b2ce29495 100644 --- a/integrate_test/registry/servicediscovery/nacos/tests/integration/main_test.go +++ b/integrate_test/registry/servicediscovery/nacos/tests/integration/main_test.go @@ -35,7 +35,9 @@ var greeterProvider = &dubbo3pb.GreeterClientImpl{} func TestMain(m *testing.M) { config.SetConsumerService(greeterProvider) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/registry/servicediscovery/zookeeper/tests/integration/helloworld_test.go b/integrate_test/registry/servicediscovery/zookeeper/tests/integration/helloworld_test.go index 971a8a806..0a186a485 100644 --- a/integrate_test/registry/servicediscovery/zookeeper/tests/integration/helloworld_test.go +++ b/integrate_test/registry/servicediscovery/zookeeper/tests/integration/helloworld_test.go @@ -35,8 +35,6 @@ func TestSayHello(t *testing.T) { Name: "laurence", } - reply := &dubbo3pb.User{} - ctx := context.Background() reply, err := greeterProvider.SayHello(ctx, req) diff --git a/integrate_test/registry/servicediscovery/zookeeper/tests/integration/main_test.go b/integrate_test/registry/servicediscovery/zookeeper/tests/integration/main_test.go index cbc239d15..b2ce29495 100644 --- a/integrate_test/registry/servicediscovery/zookeeper/tests/integration/main_test.go +++ b/integrate_test/registry/servicediscovery/zookeeper/tests/integration/main_test.go @@ -35,7 +35,9 @@ var greeterProvider = &dubbo3pb.GreeterClientImpl{} func TestMain(m *testing.M) { config.SetConsumerService(greeterProvider) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/registry/zookeeper/tests/integration/helloworld_test.go b/integrate_test/registry/zookeeper/tests/integration/helloworld_test.go index 971a8a806..0a186a485 100644 --- a/integrate_test/registry/zookeeper/tests/integration/helloworld_test.go +++ b/integrate_test/registry/zookeeper/tests/integration/helloworld_test.go @@ -35,8 +35,6 @@ func TestSayHello(t *testing.T) { Name: "laurence", } - reply := &dubbo3pb.User{} - ctx := context.Background() reply, err := greeterProvider.SayHello(ctx, req) diff --git a/integrate_test/registry/zookeeper/tests/integration/main_test.go b/integrate_test/registry/zookeeper/tests/integration/main_test.go index cbc239d15..b2ce29495 100644 --- a/integrate_test/registry/zookeeper/tests/integration/main_test.go +++ b/integrate_test/registry/zookeeper/tests/integration/main_test.go @@ -35,7 +35,9 @@ var greeterProvider = &dubbo3pb.GreeterClientImpl{} func TestMain(m *testing.M) { config.SetConsumerService(greeterProvider) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/rpc/dubbo/tests/integration/main_test.go b/integrate_test/rpc/dubbo/tests/integration/main_test.go index 9345bb5ff..111d778c1 100644 --- a/integrate_test/rpc/dubbo/tests/integration/main_test.go +++ b/integrate_test/rpc/dubbo/tests/integration/main_test.go @@ -40,7 +40,9 @@ func TestMain(m *testing.M) { hessian.RegisterJavaEnum(Gender(MAN)) hessian.RegisterJavaEnum(Gender(WOMAN)) hessian.RegisterPOJO(&User{}) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/rpc/dubbo/tests/integration/userprovider_test.go b/integrate_test/rpc/dubbo/tests/integration/userprovider_test.go index 001300620..69f15d56c 100644 --- a/integrate_test/rpc/dubbo/tests/integration/userprovider_test.go +++ b/integrate_test/rpc/dubbo/tests/integration/userprovider_test.go @@ -85,7 +85,7 @@ func TestGetUser0(t *testing.T) { assert.Nil(t, err) assert.NotNil(t, user) - user, err = userProvider.GetUser0("003", "MOORSE") + _, err = userProvider.GetUser0("003", "MOORSE") assert.NotNil(t, err) } diff --git a/integrate_test/rpc/grpc/tests/integration/main_test.go b/integrate_test/rpc/grpc/tests/integration/main_test.go index cda7d7e38..b4c63d889 100644 --- a/integrate_test/rpc/grpc/tests/integration/main_test.go +++ b/integrate_test/rpc/grpc/tests/integration/main_test.go @@ -35,7 +35,10 @@ var grpcGreeterImpl = new(pb.GreeterClientImpl) func TestMain(m *testing.M) { config.SetConsumerService(grpcGreeterImpl) - config.Load() + err := config.Load() + if err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/rpc/jsonrpc/tests/integration/main_test.go b/integrate_test/rpc/jsonrpc/tests/integration/main_test.go index 24e340f1f..bbb5d1b64 100644 --- a/integrate_test/rpc/jsonrpc/tests/integration/main_test.go +++ b/integrate_test/rpc/jsonrpc/tests/integration/main_test.go @@ -45,7 +45,9 @@ func init() { func TestMain(m *testing.M) { - config.Load() + if err := config.Load(); err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/rpc/triple/codec-extension/tests/integration/main_test.go b/integrate_test/rpc/triple/codec-extension/tests/integration/main_test.go index 44d76fc23..912cfa046 100644 --- a/integrate_test/rpc/triple/codec-extension/tests/integration/main_test.go +++ b/integrate_test/rpc/triple/codec-extension/tests/integration/main_test.go @@ -32,7 +32,10 @@ var userProvider = new(UserProvider) func TestMain(m *testing.M) { config.SetConsumerService(userProvider) - config.Load() + err := config.Load() + if err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/rpc/triple/hessian2/tests/integration/main_test.go b/integrate_test/rpc/triple/hessian2/tests/integration/main_test.go index dec3dcf14..a881349fa 100644 --- a/integrate_test/rpc/triple/hessian2/tests/integration/main_test.go +++ b/integrate_test/rpc/triple/hessian2/tests/integration/main_test.go @@ -35,7 +35,9 @@ var userProvider = new(UserProvider) func TestMain(m *testing.M) { config.SetConsumerService(userProvider) hessian.RegisterPOJO(&User{}) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } os.Exit(m.Run()) } diff --git a/integrate_test/rpc/triple/msgpack/tests/integration/main_test.go b/integrate_test/rpc/triple/msgpack/tests/integration/main_test.go index e94ceccf5..b14a7ebbb 100644 --- a/integrate_test/rpc/triple/msgpack/tests/integration/main_test.go +++ b/integrate_test/rpc/triple/msgpack/tests/integration/main_test.go @@ -19,6 +19,7 @@ package integration import ( "context" + "fmt" "os" "testing" ) @@ -36,7 +37,10 @@ var userProvider = new(UserProvider) func TestMain(m *testing.M) { config.SetConsumerService(userProvider) - config.Load() + if err := config.Load(); err != nil { + fmt.Println("test client init error = ", err) + os.Exit(1) + } os.Exit(m.Run()) } diff --git a/logger/custom/cmd/main.go b/logger/custom/cmd/main.go index dcb0484c3..2bec51177 100644 --- a/logger/custom/cmd/main.go +++ b/logger/custom/cmd/main.go @@ -85,7 +85,9 @@ func (c *customLogger) Fatalf(fmts string, args ...interface{}) { func main() { config.SetProviderService(&GreeterProvider{}) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } logger.SetLogger(&customLogger{}) ctx, cancel := context.WithTimeout(context.Background(), time.Second*3) defer cancel() diff --git a/logger/default/cmd/main.go b/logger/default/cmd/main.go index 3013b6c4b..d9f0f8e58 100644 --- a/logger/default/cmd/main.go +++ b/logger/default/cmd/main.go @@ -38,7 +38,10 @@ type GreeterProvider struct { func main() { config.SetProviderService(&GreeterProvider{}) - config.Load() + err := config.Load() + if err != nil { + panic(err) + } ctx, cancel := context.WithTimeout(context.Background(), time.Second*3) defer cancel() for { diff --git a/logger/default/conf/dubbogo.yml b/logger/default/conf/dubbogo.yml index 8419ac038..715d2e30c 100644 --- a/logger/default/conf/dubbogo.yml +++ b/logger/default/conf/dubbogo.yml @@ -9,9 +9,9 @@ dubbo: name: tri port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: greeterImpl: - protocolIDs: triple + protocol-ids: triple interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java \ No newline at end of file diff --git a/logger/level/cmd/main.go b/logger/level/cmd/main.go index 74c05aa29..f347e30a0 100644 --- a/logger/level/cmd/main.go +++ b/logger/level/cmd/main.go @@ -38,7 +38,9 @@ type GreeterProvider struct { func main() { config.SetProviderService(&GreeterProvider{}) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } ctx, cancel := context.WithTimeout(context.Background(), time.Second*3) defer cancel() logger.SetLoggerLevel("warn") diff --git a/logger/level/conf/dubbogo.yml b/logger/level/conf/dubbogo.yml index 8419ac038..715d2e30c 100644 --- a/logger/level/conf/dubbogo.yml +++ b/logger/level/conf/dubbogo.yml @@ -9,9 +9,9 @@ dubbo: name: tri port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: greeterImpl: - protocolIDs: triple + protocol-ids: triple interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java \ No newline at end of file diff --git a/logger/rolling/cmd/main.go b/logger/rolling/cmd/main.go index 50944148a..21cb843fe 100644 --- a/logger/rolling/cmd/main.go +++ b/logger/rolling/cmd/main.go @@ -38,7 +38,9 @@ type GreeterProvider struct { func main() { config.SetProviderService(&GreeterProvider{}) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } ctx, cancel := context.WithTimeout(context.Background(), time.Second*20) defer cancel() for { diff --git a/logger/rolling/conf/dubbogo.yml b/logger/rolling/conf/dubbogo.yml index 14fbba0d3..0d1ecef03 100644 --- a/logger/rolling/conf/dubbogo.yml +++ b/logger/rolling/conf/dubbogo.yml @@ -9,11 +9,11 @@ dubbo: name: tri port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: greeterImpl: - protocolIDs: triple + protocol-ids: triple interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java logger: lumberjack-config: diff --git a/metrics/go-client/cmd/client.go b/metrics/go-client/cmd/client.go new file mode 100644 index 000000000..80c9ab8a0 --- /dev/null +++ b/metrics/go-client/cmd/client.go @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package main + +import ( + "context" +) + +import ( + "dubbo.apache.org/dubbo-go/v3/common/logger" + "dubbo.apache.org/dubbo-go/v3/config" + _ "dubbo.apache.org/dubbo-go/v3/imports" +) + +import ( + "github.com/apache/dubbo-go-samples/api" +) + +var grpcGreeterImpl = new(api.GreeterClientImpl) + +// export DUBBO_GO_CONFIG_PATH= PATH_TO_SAMPLES/helloworld/go-client/conf/dubbogo.yml +func main() { + config.SetConsumerService(grpcGreeterImpl) + if err := config.Load(); err != nil { + panic(err) + } + + logger.Info("start to test dubbo") + req := &api.HelloRequest{ + Name: "laurence", + } + reply, err := grpcGreeterImpl.SayHello(context.Background(), req) + if err != nil { + logger.Error(err) + } + logger.Infof("client response result: %v\n", reply) +} diff --git a/metrics/go-client/conf/dubbogo.yml b/metrics/go-client/conf/dubbogo.yml new file mode 100644 index 000000000..e5fbbafb0 --- /dev/null +++ b/metrics/go-client/conf/dubbogo.yml @@ -0,0 +1,13 @@ +dubbo: + registries: + demoZK: + protocol: zookeeper + timeout: 3s + address: 127.0.0.1:2181 + consumer: + registry-ids: + - demoZK + references: + GreeterClientImpl: + protocol: tri + interface: com.apache.dubbo.HelloService # must be compatible with grpc or dubbo-java diff --git a/metrics/go-server/cmd/server.go b/metrics/go-server/cmd/server.go new file mode 100644 index 000000000..c278dc0c3 --- /dev/null +++ b/metrics/go-server/cmd/server.go @@ -0,0 +1,100 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package main + +import ( + "context" + "math/rand" + "time" +) + +import ( + "dubbo.apache.org/dubbo-go/v3/common/logger" + "dubbo.apache.org/dubbo-go/v3/config" + _ "dubbo.apache.org/dubbo-go/v3/imports" + "dubbo.apache.org/dubbo-go/v3/metrics/prometheus" +) + +import ( + "github.com/apache/dubbo-go-samples/api" +) + +type GreeterProvider struct { + api.GreeterProviderBase +} + +func (s *GreeterProvider) SayHello(ctx context.Context, in *api.HelloRequest) (*api.User, error) { + logger.Infof("Dubbo3 GreeterProvider get user name = %s\n", in.Name) + return &api.User{Name: "Hello " + in.Name, Id: "12345", Age: 21}, nil +} + +/* metrics in localhost:9090: +userCounterVec# HELP dubbo_test_counter +# TYPE dubbo_test_counter counter +dubbo_test_counter 36 +# HELP dubbo_test_counter_with_label +# TYPE dubbo_test_counter_with_label counter +dubbo_test_counter_with_label{counterlabel1="value1",counterlabel2="value2"} 36 +# HELP dubbo_test_gauge +# TYPE dubbo_test_gauge gauge +dubbo_test_gauge 0.4503573689185021 +# HELP dubbo_test_gauge_with_label +# TYPE dubbo_test_gauge_with_label gauge +dubbo_test_gauge_with_label{gaugelabel1="value1",gaugelabel2="value2"} 0.3152981056786652 +# HELP dubbo_test_summary +# TYPE dubbo_test_summary summary +dubbo_test_summary_sum 19.88640045117142 +dubbo_test_summary_count 36 +# HELP dubbo_test_summary_with_label +# TYPE dubbo_test_summary_with_label summary +dubbo_test_summary_with_label{summarylabel1="value1",summarylabel2="value2",quantile="0.5"} 0.6103291015556667 +dubbo_test_summary_with_label{summarylabel1="value1",summarylabel2="value2",quantile="0.75"} 0.7991992117286294 +dubbo_test_summary_with_label{summarylabel1="value1",summarylabel2="value2",quantile="0.9"} 0.937731048284269 +dubbo_test_summary_with_label{summarylabel1="value1",summarylabel2="value2",quantile="0.98"} 0.9806989584755814 +dubbo_test_summary_with_label{summarylabel1="value1",summarylabel2="value2",quantile="0.99"} 0.9806989584755814 +dubbo_test_summary_with_label{summarylabel1="value1",summarylabel2="value2",quantile="0.999"} 0.9806989584755814 +dubbo_test_summary_with_label_sum{summarylabel1="value1",summarylabel2="value2"} 18.896320346046032 +dubbo_test_summary_with_label_count{summarylabel1="value1",summarylabel2="value2"} 36 +*/ +func main() { + config.SetProviderService(&GreeterProvider{}) + if err := config.Load(); err != nil { + panic(err) + } + for { + // metrics refresh per second + time.Sleep(time.Second) + prometheus.IncSummary("test_summary", rand.Float64()) + prometheus.IncSummaryWithLabel("test_summary_with_label", rand.Float64(), map[string]string{ + "summarylabel1": "value1", // label and value for this summary + "summarylabel2": "value2", + }) + + prometheus.IncCounter("test_counter") + prometheus.IncCounterWithLabel("test_counter_with_label", map[string]string{ + "counterlabel1": "value1", // label and value for this counter + "counterlabel2": "value2", + }) + + prometheus.SetGauge("test_gauge", rand.Float64()) + prometheus.SetGaugeWithLabel("test_gauge_with_label", rand.Float64(), map[string]string{ + "gaugelabel1": "value1", + "gaugelabel2": "value2", + }) + } +} diff --git a/metrics/go-server/conf/dubbogo.yml b/metrics/go-server/conf/dubbogo.yml new file mode 100644 index 000000000..ccd91c91a --- /dev/null +++ b/metrics/go-server/conf/dubbogo.yml @@ -0,0 +1,19 @@ +dubbo: + metrics: + enable: true # default is true + path: /custom-metrics-path # default is /metrics + port: 9091 # default is 9090 + registries: + myzk: + protocol: zookeeper + address: localhost:2181 + protocols: + triple: + name: tri + port: 20000 + provider: + registry-ids: myzk + services: + GreeterProvider: + protocol-ids: triple + interface: com.apache.dubbo.HelloService # must be compatible with grpc or dubbo-java diff --git a/registry/etcd/go-client/cmd/client.go b/registry/etcd/go-client/cmd/client.go index 44ed536b3..f7049394d 100644 --- a/registry/etcd/go-client/cmd/client.go +++ b/registry/etcd/go-client/cmd/client.go @@ -47,7 +47,9 @@ func init() { // `export DUBBO_GO_CONFIG_PATH= ROOT_PATH/conf/dubbogo.yml` or `dubbogo.yaml` func main() { hessian.RegisterPOJO(&pkg.User{}) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } gxlog.CInfo("\n\n\nstart to test dubbo") user := &pkg.User{ diff --git a/registry/etcd/go-client/conf/dubbogo.yml b/registry/etcd/go-client/conf/dubbogo.yml index dea42666a..230d966c5 100644 --- a/registry/etcd/go-client/conf/dubbogo.yml +++ b/registry/etcd/go-client/conf/dubbogo.yml @@ -17,6 +17,6 @@ dubbo: consumer: references: UserProvider: - registryIDs: "etcd" + registry-ids: "etcd" protocol: "dubbo" interface: "org.apache.dubbo.UserProvider" \ No newline at end of file diff --git a/registry/etcd/go-server/cmd/server.go b/registry/etcd/go-server/cmd/server.go index adea6bac3..287b2b956 100644 --- a/registry/etcd/go-server/cmd/server.go +++ b/registry/etcd/go-server/cmd/server.go @@ -46,15 +46,16 @@ var ( // `export DUBBO_GO_CONFIG_PATH= ROOT_PATH/conf/dubbogo.yml` or `dubbogo.yaml` func main() { hessian.RegisterPOJO(&pkg.User{}) - config.Load() - + if err := config.Load(); err != nil { + panic(err) + } initSignal() } func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) diff --git a/registry/etcd/go-server/conf/dubbogo.yml b/registry/etcd/go-server/conf/dubbogo.yml index 9fc777dfa..d5138a470 100644 --- a/registry/etcd/go-server/conf/dubbogo.yml +++ b/registry/etcd/go-server/conf/dubbogo.yml @@ -15,7 +15,7 @@ dubbo: name: "dubbo" port: 20000 provider: - registryIDs: + registry-ids: - etcd services: UserProvider: diff --git a/registry/nacos/go-client/cmd/client.go b/registry/nacos/go-client/cmd/client.go index 147db6def..9e1758750 100644 --- a/registry/nacos/go-client/cmd/client.go +++ b/registry/nacos/go-client/cmd/client.go @@ -24,12 +24,11 @@ import ( ) import ( + "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" _ "dubbo.apache.org/dubbo-go/v3/imports" hessian "github.com/apache/dubbo-go-hessian2" - - "github.com/dubbogo/gost/log" ) type UserProvider struct { @@ -47,19 +46,21 @@ func (u *User) JavaClassName() string { return "org.apache.dubbo.User" } -// need to setup environment variable "CONF_CONSUMER_FILE_PATH" to "conf/client.yml" before run func main() { var userProvider = &UserProvider{} config.SetConsumerService(userProvider) hessian.RegisterPOJO(&User{}) - config.Load() + err := config.Load() + if err != nil { + panic(err) + } - gxlog.CInfo("\n\n\nstart to test dubbo") + logger.Infof("\n\n\nstart to test dubbo") user, err := userProvider.GetUser(context.TODO(), &User{Name: "Alex001"}) if err != nil { - gxlog.CError("error: %v\n", err) + logger.Errorf("error: %v\n", err) os.Exit(1) return } - gxlog.CInfo("response result: %v\n", user) + logger.Infof("response result: %v\n", user) } diff --git a/registry/nacos/go-client/conf/dubbogo.yml b/registry/nacos/go-client/conf/dubbogo.yml index 7c6671196..5865a222c 100644 --- a/registry/nacos/go-client/conf/dubbogo.yml +++ b/registry/nacos/go-client/conf/dubbogo.yml @@ -29,7 +29,7 @@ dubbo: max-msg-len: 1024000 session-name: client consumer: - registryIDs: + registry-ids: - demoNacos references: UserProvider: diff --git a/registry/nacos/go-server/cmd/server.go b/registry/nacos/go-server/cmd/server.go index 9aedb8620..35d9294f5 100644 --- a/registry/nacos/go-server/cmd/server.go +++ b/registry/nacos/go-server/cmd/server.go @@ -77,7 +77,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) diff --git a/registry/nacos/go-server/conf/dubbogo.yml b/registry/nacos/go-server/conf/dubbogo.yml index eb41ac294..4f61135b2 100644 --- a/registry/nacos/go-server/conf/dubbogo.yml +++ b/registry/nacos/go-server/conf/dubbogo.yml @@ -25,7 +25,7 @@ dubbo: max-msg-len: 1024000 session-name: server provider: - registryIDs: + registry-ids: - demoNacos services: UserProvider: diff --git a/registry/servicediscovery/nacos/go-client/conf/dubbogo.yml b/registry/servicediscovery/nacos/go-client/conf/dubbogo.yml index 684a89c10..4e74990e6 100644 --- a/registry/servicediscovery/nacos/go-client/conf/dubbogo.yml +++ b/registry/servicediscovery/nacos/go-client/conf/dubbogo.yml @@ -8,7 +8,7 @@ dubbo: protocol: nacos address: 127.0.0.1:8848 consumer: - registryIDs: + registry-ids: - demoZK references: GreeterClientImpl: diff --git a/registry/servicediscovery/nacos/go-server/conf/dubbogo.yml b/registry/servicediscovery/nacos/go-server/conf/dubbogo.yml index 805f79815..8b2aface3 100644 --- a/registry/servicediscovery/nacos/go-server/conf/dubbogo.yml +++ b/registry/servicediscovery/nacos/go-server/conf/dubbogo.yml @@ -12,9 +12,9 @@ dubbo: name: tri port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: GreeterProvider: - protocolIDs: triple + protocol-ids: triple interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java \ No newline at end of file diff --git a/registry/servicediscovery/zookeeper/go-client/conf/dubbogo.yml b/registry/servicediscovery/zookeeper/go-client/conf/dubbogo.yml index f941a3c7d..0b48ca686 100644 --- a/registry/servicediscovery/zookeeper/go-client/conf/dubbogo.yml +++ b/registry/servicediscovery/zookeeper/go-client/conf/dubbogo.yml @@ -8,7 +8,7 @@ dubbo: protocol: zookeeper address: 127.0.0.1:2181 consumer: - registryIDs: + registry-ids: - demoZK references: GreeterClientImpl: diff --git a/registry/servicediscovery/zookeeper/go-server/conf/dubbogo.yml b/registry/servicediscovery/zookeeper/go-server/conf/dubbogo.yml index 9f970cfec..e489e2b2f 100644 --- a/registry/servicediscovery/zookeeper/go-server/conf/dubbogo.yml +++ b/registry/servicediscovery/zookeeper/go-server/conf/dubbogo.yml @@ -12,9 +12,9 @@ dubbo: name: tri port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: GreeterProvider: - protocolIDs: triple + protocol-ids: triple interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java \ No newline at end of file diff --git a/registry/zookeeper/go-client/conf/dubbogo.yml b/registry/zookeeper/go-client/conf/dubbogo.yml index 59498477c..cf11a8414 100644 --- a/registry/zookeeper/go-client/conf/dubbogo.yml +++ b/registry/zookeeper/go-client/conf/dubbogo.yml @@ -5,7 +5,7 @@ dubbo: timeout: 3s address: 127.0.0.1:2181 consumer: - registryIDs: + registry-ids: - demoZK references: GreeterClientImpl: diff --git a/registry/zookeeper/go-server/cmd/server.go b/registry/zookeeper/go-server/cmd/server.go index ffe7f4673..a6a1bc364 100644 --- a/registry/zookeeper/go-server/cmd/server.go +++ b/registry/zookeeper/go-server/cmd/server.go @@ -64,7 +64,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) diff --git a/registry/zookeeper/go-server/conf/dubbogo.yml b/registry/zookeeper/go-server/conf/dubbogo.yml index b59f564e1..69879043f 100644 --- a/registry/zookeeper/go-server/conf/dubbogo.yml +++ b/registry/zookeeper/go-server/conf/dubbogo.yml @@ -9,9 +9,9 @@ dubbo: name: tri port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: GreeterProvider: - protocolIDs: triple + protocol-ids: triple interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java \ No newline at end of file diff --git a/route/meshroute/go-client/conf/dubbogo.yml b/route/meshroute/go-client/conf/dubbogo.yml index 64c0aacef..91324f5c4 100644 --- a/route/meshroute/go-client/conf/dubbogo.yml +++ b/route/meshroute/go-client/conf/dubbogo.yml @@ -5,7 +5,7 @@ dubbo: timeout: 3s address: 127.0.0.1:2181 consumer: - registryIDs: + registry-ids: - demoZK references: GreeterClientImpl: diff --git a/route/meshroute/go-server/conf/dubbogo.yml b/route/meshroute/go-server/conf/dubbogo.yml index b9e6bd248..f8f98d1ed 100644 --- a/route/meshroute/go-server/conf/dubbogo.yml +++ b/route/meshroute/go-server/conf/dubbogo.yml @@ -9,11 +9,11 @@ dubbo: name: tri port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: GreeterProvider: - protocolIDs: triple + protocol-ids: triple interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java params: env-sign: yyy diff --git a/rpc/dubbo/go-client/cmd/client.go b/rpc/dubbo/go-client/cmd/client.go index 5100720f2..fe26895d0 100644 --- a/rpc/dubbo/go-client/cmd/client.go +++ b/rpc/dubbo/go-client/cmd/client.go @@ -45,7 +45,10 @@ func main() { config.SetConsumerService(userProvider) - config.Load() + err := config.Load() + if err != nil { + panic(err) + } logger.Infof("\n\ntest") test() @@ -91,9 +94,9 @@ func test() { logger.Infof("response result: %v", ret1) logger.Infof("\n\n\nstart to test dubbo - getUser") - user = &pkg.User{} + var i int32 = 1 - user, err = userProvider.GetUser2(context.TODO(), i) + _, err = userProvider.GetUser2(context.TODO(), i) if err != nil { panic(err) } @@ -101,7 +104,7 @@ func test() { logger.Infof("\n\n\nstart to test dubbo - getErr") reqUser.ID = "003" - user, err = userProvider.GetErr(context.TODO(), reqUser) + _, err = userProvider.GetErr(context.TODO(), reqUser) if err == nil { panic("err is nil") } @@ -109,7 +112,7 @@ func test() { logger.Infof("\n\n\nstart to test dubbo illegal method") reqUser.ID = "003" - user, err = userProvider.GetUser1(context.TODO(), reqUser) + _, err = userProvider.GetUser1(context.TODO(), reqUser) if err == nil { panic("err is nil") } diff --git a/rpc/dubbo/go-client/conf/dubbogo.yml b/rpc/dubbo/go-client/conf/dubbogo.yml index fd2ca9c7a..673f9d2bf 100644 --- a/rpc/dubbo/go-client/conf/dubbogo.yml +++ b/rpc/dubbo/go-client/conf/dubbogo.yml @@ -7,7 +7,7 @@ dubbo: timeout: "3s" address: "127.0.0.1:2181" consumer: - registryIDs: + registry-ids: - demoZK references: "UserProvider": diff --git a/rpc/dubbo/go-server/cmd/server.go b/rpc/dubbo/go-server/cmd/server.go index cd0bbbe16..9ae5415c4 100644 --- a/rpc/dubbo/go-server/cmd/server.go +++ b/rpc/dubbo/go-server/cmd/server.go @@ -53,7 +53,9 @@ func main() { config.SetProviderService(&pkg.WrapperArrayClassProvider{}) // ------------ - config.Load() + if err := config.Load(); err != nil { + panic(err) + } initSignal() } @@ -61,7 +63,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) diff --git a/rpc/dubbo/go-server/conf/dubbogo.yml b/rpc/dubbo/go-server/conf/dubbogo.yml index 489dd3f83..a72e579c2 100644 --- a/rpc/dubbo/go-server/conf/dubbogo.yml +++ b/rpc/dubbo/go-server/conf/dubbogo.yml @@ -11,7 +11,7 @@ dubbo: name: dubbo port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: UserProvider: diff --git a/rpc/grpc/go-client/cmd/client.go b/rpc/grpc/go-client/cmd/client.go index 0de59740e..1cda6ab57 100644 --- a/rpc/grpc/go-client/cmd/client.go +++ b/rpc/grpc/go-client/cmd/client.go @@ -40,7 +40,9 @@ func init() { // need to setup environment variable "CONF_CONSUMER_FILE_PATH" to "conf/client.yml" before run func main() { - config.Load() + if err := config.Load(); err != nil { + panic(err) + } gxlog.CInfo("\n\n\nstart to test dubbo") req := &pb.HelloRequest{ diff --git a/rpc/grpc/go-client/conf/dubbogo.yml b/rpc/grpc/go-client/conf/dubbogo.yml index 3cbb6ce32..c198207c2 100644 --- a/rpc/grpc/go-client/conf/dubbogo.yml +++ b/rpc/grpc/go-client/conf/dubbogo.yml @@ -7,7 +7,7 @@ dubbo: timeout: 3s address: 127.0.0.1:2181 consumer: - registryIDs: + registry-ids: - demoZK references: GreeterClientImpl: diff --git a/rpc/grpc/go-server/cmd/server.go b/rpc/grpc/go-server/cmd/server.go index e78b709f0..979557386 100644 --- a/rpc/grpc/go-server/cmd/server.go +++ b/rpc/grpc/go-server/cmd/server.go @@ -61,7 +61,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) diff --git a/rpc/grpc/go-server/conf/dubbogo.yml b/rpc/grpc/go-server/conf/dubbogo.yml index 0328f5182..2bbf07095 100644 --- a/rpc/grpc/go-server/conf/dubbogo.yml +++ b/rpc/grpc/go-server/conf/dubbogo.yml @@ -11,11 +11,11 @@ dubbo: name: grpc port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: GreeterProvider: - protocolIDs: grpcProtocol + protocol-ids: grpcProtocol interface: org.apache.dubbo.UserProvider logger: zap-config: diff --git a/rpc/jsonrpc/go-client/cmd/client.go b/rpc/jsonrpc/go-client/cmd/client.go index 470bdcbad..a05705456 100644 --- a/rpc/jsonrpc/go-client/cmd/client.go +++ b/rpc/jsonrpc/go-client/cmd/client.go @@ -37,6 +37,7 @@ import ( ) var ( + // nolint survivalTimeout int = 10e9 userProvider = &pkg.UserProvider{} userProvider1 = &pkg.UserProvider1{} @@ -53,8 +54,9 @@ func init() { // 1. env config // `export DUBBO_GO_CONFIG_PATH= ROOT_PATH/conf/dubbogo.yml` or `dubbogo.yaml` func main() { - - config.Load() + if err := config.Load(); err != nil { + panic(err) + } logger.Infof("\n\ntest") test() @@ -64,10 +66,11 @@ func main() { test2() } +// nolint func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, + signal.Notify(signals, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals @@ -171,7 +174,7 @@ func test1() { logger.Infof("response result: %v", ret) logger.Infof("\n\n\nstart to test jsonrpc - getUser") - user, err = userProvider1.GetUser2(context.TODO(), "1") + _, err = userProvider1.GetUser2(context.TODO(), "1") if err != nil { panic(err) } @@ -185,7 +188,7 @@ func test1() { logger.Infof("succ!") logger.Infof("\n\n\nstart to test jsonrpc illegal method") - user, err = userProvider1.GetUser1(context.TODO(), "A003") + _, err = userProvider1.GetUser1(context.TODO(), "A003") if err == nil { panic("err is nil") } @@ -232,7 +235,7 @@ func test2() { logger.Infof("succ!") logger.Infof("\n\n\nstart to test jsonrpc illegal method") - user, err = userProvider2.GetUser1(context.TODO(), "A003") + _, err = userProvider2.GetUser1(context.TODO(), "A003") if err == nil { panic("err is nil") } diff --git a/rpc/jsonrpc/go-client/conf/dubbogo.yml b/rpc/jsonrpc/go-client/conf/dubbogo.yml index b009e237a..39e22bd25 100644 --- a/rpc/jsonrpc/go-client/conf/dubbogo.yml +++ b/rpc/jsonrpc/go-client/conf/dubbogo.yml @@ -13,16 +13,16 @@ dubbo: consumer: references: UserProvider: - registryIDs: hangzhouzk + registry-ids: hangzhouzk protocol: jsonrpc interface: com.ikurento.user.UserProvider UserProvider1: - registryIDs: hangzhouzk + registry-ids: hangzhouzk protocol: jsonrpc version: 2.0 interface: com.ikurento.user.UserProvider UserProvider2: - registryIDs: hangzhouzk + registry-ids: hangzhouzk protocol: jsonrpc version: 2.0 group: as diff --git a/rpc/jsonrpc/go-server/cmd/server.go b/rpc/jsonrpc/go-server/cmd/server.go index dcb7a9cf8..9fad28f36 100644 --- a/rpc/jsonrpc/go-server/cmd/server.go +++ b/rpc/jsonrpc/go-server/cmd/server.go @@ -44,7 +44,10 @@ var ( // `export DUBBO_GO_CONFIG_PATH= ROOT_PATH/conf/dubbogo.yml` or `dubbogo.yaml` func main() { - config.Load() + err := config.Load() + if err != nil { + panic(err) + } initSignal() } @@ -52,7 +55,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) diff --git a/rpc/jsonrpc/go-server/conf/dubbogo.yml b/rpc/jsonrpc/go-server/conf/dubbogo.yml index 68dc3cab0..7b6661a2c 100644 --- a/rpc/jsonrpc/go-server/conf/dubbogo.yml +++ b/rpc/jsonrpc/go-server/conf/dubbogo.yml @@ -16,21 +16,21 @@ dubbo: ip: 127.0.0.1 port: 20001 provider: - registryIDs: + registry-ids: - hangzhouzk services: UserProvider: - registryIDs: hangzhouzk - protocolIDs: jsonrpc + registry-ids: hangzhouzk + protocol-ids: jsonrpc interface: com.ikurento.user.UserProvider UserProvider1: - registryIDs: hangzhouzk - protocolIDs: jsonrpc + registry-ids: hangzhouzk + protocol-ids: jsonrpc interface: com.ikurento.user.UserProvider version: 2.0 UserProvider2: - registryIDs: hangzhouzk - protocolIDs: jsonrpc + registry-ids: hangzhouzk + protocol-ids: jsonrpc interface: com.ikurento.user.UserProvider version: 2.0 group: as diff --git a/rpc/triple/README.md b/rpc/triple/README.md index d0ced4016..5a066a582 100644 --- a/rpc/triple/README.md +++ b/rpc/triple/README.md @@ -25,7 +25,7 @@ dubbo: provider: services: MyProvider: # service provider type name - protocolIDs: myProtocol # user defined protocol key,as above myProtocol defined + protocol-ids: myProtocol # user defined protocol key,as above myProtocol defined interface: org.apache.dubbogo.MyProvider # user defined interface name # serialization: hessian2 # serialization that can be choosed:pb/hessian2/custome # pb serialization by default diff --git a/rpc/triple/README_zh.md b/rpc/triple/README_zh.md index eb4356b75..c0e88fe9a 100644 --- a/rpc/triple/README_zh.md +++ b/rpc/triple/README_zh.md @@ -24,7 +24,7 @@ dubbo: provider: services: MyProvider: # 服务提供者结构类名 - protocolIDs: myProtocol # 自定义的协议 Key,与上方 myProtocol 对应 + protocol-ids: myProtocol # 自定义的协议 Key,与上方 myProtocol 对应 interface: org.apache.dubbogo.MyProvider # 用户自定义的接口名 # serialization: hessian2 可选字段,可以指定序列化类型:pb/hessian2/自定义 # 默认使用 pb 序列化 diff --git a/rpc/triple/codec-extension/go-client/conf/dubbogo.yml b/rpc/triple/codec-extension/go-client/conf/dubbogo.yml index 2a332d6f0..6e5147121 100644 --- a/rpc/triple/codec-extension/go-client/conf/dubbogo.yml +++ b/rpc/triple/codec-extension/go-client/conf/dubbogo.yml @@ -4,7 +4,7 @@ dubbo: protocol: zookeeper address: 127.0.0.1:2181 consumer: - registryIDs: + registry-ids: - registryKey references: UserProvider: diff --git a/rpc/triple/codec-extension/go-server/conf/dubbogo.yml b/rpc/triple/codec-extension/go-server/conf/dubbogo.yml index f0a7cdf67..9151e002b 100644 --- a/rpc/triple/codec-extension/go-server/conf/dubbogo.yml +++ b/rpc/triple/codec-extension/go-server/conf/dubbogo.yml @@ -8,10 +8,10 @@ dubbo: name: tri port: 20000 provider: - registryIDs: + registry-ids: - registryKey services: UserProvider: - protocolIDs: tripleKey + protocol-ids: tripleKey serialization: json interface: com.apache.dubbogo.samples.rpc.extension.UserProvider # must be compatible with grpc or dubbo-java \ No newline at end of file diff --git a/rpc/triple/hessian2/README.md b/rpc/triple/hessian2/README.md index 57d282d49..31b05b6f5 100644 --- a/rpc/triple/hessian2/README.md +++ b/rpc/triple/hessian2/README.md @@ -11,8 +11,8 @@ PB serialization is used by default. To use Hessian2+PB, please specify the seri # service config services: "UserProvider": - registryIDs: "demoZK" - protocolIDs: "tri" # tri is dubbo-go3.0 protocol + registry-ids: "demoZK" + protocol-ids: "tri" # tri is dubbo-go3.0 protocol serialization: "hessian2" # hessian2 is serialization type interface: "org.apache.dubbo.UserProvider" ``` diff --git a/rpc/triple/hessian2/README_zh.md b/rpc/triple/hessian2/README_zh.md index 55f3dff05..cbca22c19 100644 --- a/rpc/triple/hessian2/README_zh.md +++ b/rpc/triple/hessian2/README_zh.md @@ -11,8 +11,8 @@ https://github.com/dubbogo/triple/blob/master/internal/codec/proto/triple_wrappe # service config services: "UserProvider": - registryIDs: "demoZK" - protocolIDs: "tri" # tri is dubbo-go3.0 protocol + registry-ids: "demoZK" + protocol-ids: "tri" # tri is dubbo-go3.0 protocol serialization: "hessian2" # hessian2 is serialization type interface: "org.apache.dubbo.UserProvider" ``` diff --git a/rpc/triple/hessian2/go-client/cmd/client.go b/rpc/triple/hessian2/go-client/cmd/client.go index a11de4806..980541261 100644 --- a/rpc/triple/hessian2/go-client/cmd/client.go +++ b/rpc/triple/hessian2/go-client/cmd/client.go @@ -44,7 +44,9 @@ func init() { // need to setup environment variable "CONF_CONSUMER_FILE_PATH" to "conf/client.yml" before run func main() { - config.Load() + if err := config.Load(); err != nil { + panic(err) + } gxlog.CInfo("\n\n\nstart to test dubbo") testNormalService() diff --git a/rpc/triple/hessian2/go-client/conf/dubbogo.yml b/rpc/triple/hessian2/go-client/conf/dubbogo.yml index 10e0342f6..5d1b3d344 100644 --- a/rpc/triple/hessian2/go-client/conf/dubbogo.yml +++ b/rpc/triple/hessian2/go-client/conf/dubbogo.yml @@ -5,7 +5,7 @@ dubbo: timeout: "3s" address: "127.0.0.1:2181" consumer: - registryIDs: + registry-ids: - demoZK references: "ComplexProvider": diff --git a/rpc/triple/hessian2/go-server/cmd/server.go b/rpc/triple/hessian2/go-server/cmd/server.go index d977e8b61..a8f54578d 100644 --- a/rpc/triple/hessian2/go-server/cmd/server.go +++ b/rpc/triple/hessian2/go-server/cmd/server.go @@ -56,7 +56,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) diff --git a/rpc/triple/hessian2/go-server/conf/dubbogo.yml b/rpc/triple/hessian2/go-server/conf/dubbogo.yml index 7fd00ac1c..cd7bcf4d1 100644 --- a/rpc/triple/hessian2/go-server/conf/dubbogo.yml +++ b/rpc/triple/hessian2/go-server/conf/dubbogo.yml @@ -9,14 +9,14 @@ dubbo: name: "tri" port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: "UserProvider": - protocolIDs: "triple" + protocol-ids: "triple" serialization: "hessian2" interface: "com.apache.dubbo.sample.basic.IGreeter" # must be compatible with grpc or dubbo-java "ComplexProvider": - protocolIDs: "triple" + protocol-ids: "triple" serialization: "hessian2" interface: "com.apache.dubbo.sample.basic.ComplexProvider" # must be compatible with grpc or dubbo-java \ No newline at end of file diff --git a/rpc/triple/msgpack/go-client/cmd/client.go b/rpc/triple/msgpack/go-client/cmd/client.go index 183afab31..be35bac07 100644 --- a/rpc/triple/msgpack/go-client/cmd/client.go +++ b/rpc/triple/msgpack/go-client/cmd/client.go @@ -45,7 +45,9 @@ func init() { // need to setup environment variable "CONF_CONSUMER_FILE_PATH" to "conf/client.yml" before run func main() { - config.Load() + if err := config.Load(); err != nil { + panic(err) + } gxlog.CInfo("\n\n\nstart to test dubbo") user, err := userProvider.GetUser(context.TODO(), &api.User{Name: "laurence"}) diff --git a/rpc/triple/msgpack/go-client/conf/dubbogo.yml b/rpc/triple/msgpack/go-client/conf/dubbogo.yml index 842ea5336..729842877 100644 --- a/rpc/triple/msgpack/go-client/conf/dubbogo.yml +++ b/rpc/triple/msgpack/go-client/conf/dubbogo.yml @@ -5,7 +5,7 @@ dubbo: timeout: 3s address: 127.0.0.1:2181 consumer: - registryIDs: + registry-ids: - demoZK references: UserProvider: diff --git a/rpc/triple/msgpack/go-server/cmd/server.go b/rpc/triple/msgpack/go-server/cmd/server.go index 1bbbe6b70..51d91206d 100644 --- a/rpc/triple/msgpack/go-server/cmd/server.go +++ b/rpc/triple/msgpack/go-server/cmd/server.go @@ -62,14 +62,16 @@ func init() { // need to setup environment variable "CONF_PROVIDER_FILE_PATH" to "conf/server.yml" before run func main() { - config.Load() + if err := config.Load(); err != nil { + panic(err) + } initSignal() } func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) diff --git a/rpc/triple/msgpack/go-server/conf/dubbogo.yml b/rpc/triple/msgpack/go-server/conf/dubbogo.yml index 1e40c0276..33f8ea142 100644 --- a/rpc/triple/msgpack/go-server/conf/dubbogo.yml +++ b/rpc/triple/msgpack/go-server/conf/dubbogo.yml @@ -9,10 +9,10 @@ dubbo: name: tri port: 20000 provider: - registryIDs: + registry-ids: - demoZK services: UserProvider: - protocolIDs: triple + protocol-ids: triple serialization: msgpack interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java \ No newline at end of file diff --git a/rpc/triple/pb/dubbogo-grpc/go-client/cmd/client.go b/rpc/triple/pb/dubbogo-grpc/go-client/cmd/client.go index 288447aea..dde846353 100644 --- a/rpc/triple/pb/dubbogo-grpc/go-client/cmd/client.go +++ b/rpc/triple/pb/dubbogo-grpc/go-client/cmd/client.go @@ -53,7 +53,7 @@ func stream() { logger.Infof(">>>>> Dubbo-go client is about to call to SayHelloStream") ctx := context.Background() - ctx = context.WithValue(ctx, "tri-req-id", "triple-request-id-demo") + ctx = context.WithValue(ctx, tripleConstant.TripleCtxKey("tri-req-id"), "triple-request-id-demo") req := triplepb.HelloRequest{ Name: "laurence", diff --git a/rpc/triple/pb/dubbogo-grpc/go-client/conf/dubbogo.yml b/rpc/triple/pb/dubbogo-grpc/go-client/conf/dubbogo.yml index 63e389efd..eb6b3b5ed 100644 --- a/rpc/triple/pb/dubbogo-grpc/go-client/conf/dubbogo.yml +++ b/rpc/triple/pb/dubbogo-grpc/go-client/conf/dubbogo.yml @@ -3,7 +3,7 @@ dubbo: zk: address: zookeeper://127.0.0.1:2181 consumer: - registryIDs: zk + registry-ids: zk references: GreeterClientImpl: protocol: tri diff --git a/rpc/triple/pb/dubbogo-grpc/go-server/cmd/server.go b/rpc/triple/pb/dubbogo-grpc/go-server/cmd/server.go index ef3d33d9a..bf13d8495 100644 --- a/rpc/triple/pb/dubbogo-grpc/go-server/cmd/server.go +++ b/rpc/triple/pb/dubbogo-grpc/go-server/cmd/server.go @@ -53,7 +53,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) diff --git a/rpc/triple/pb/dubbogo-grpc/go-server/conf/dubbogo.yml b/rpc/triple/pb/dubbogo-grpc/go-server/conf/dubbogo.yml index 64130630b..cac576299 100644 --- a/rpc/triple/pb/dubbogo-grpc/go-server/conf/dubbogo.yml +++ b/rpc/triple/pb/dubbogo-grpc/go-server/conf/dubbogo.yml @@ -7,10 +7,10 @@ dubbo: name: tri port: 20000 provider: - registryIDs: zk + registry-ids: zk services: # you may refer to `Reference()` method defined in `protobuf/triple/helloworld.pb.go` GreeterProvider: - protocolIDs: triple + protocol-ids: triple # interface is for registry interface: org.apache.dubbo.demo.Greeter \ No newline at end of file diff --git a/rpc/triple/pb/dubbogo-grpc/go-server/pkg/greeter.go b/rpc/triple/pb/dubbogo-grpc/go-server/pkg/greeter.go index d4b5d6407..8d298e6ef 100644 --- a/rpc/triple/pb/dubbogo-grpc/go-server/pkg/greeter.go +++ b/rpc/triple/pb/dubbogo-grpc/go-server/pkg/greeter.go @@ -48,22 +48,28 @@ func (s *GreeterProvider) SayHelloStream(svr triplepb.Greeter_SayHelloStreamServ } logger.Infof("Dubbo-go3 GreeterProvider recv 2 user, name = %s\n", c2.Name) - svr.Send(&triplepb.User{ + err = svr.Send(&triplepb.User{ Name: "hello " + c.Name, Age: 18, Id: "123456789", }) + if err != nil { + return err + } c3, err := svr.Recv() if err != nil { return err } logger.Infof("Dubbo-go3 GreeterProvider recv 3 user, name = %s\n", c3.Name) - svr.Send(&triplepb.User{ + err = svr.Send(&triplepb.User{ Name: "hello " + c2.Name, Age: 19, Id: "123456789", }) + if err != nil { + return err + } return nil } diff --git a/rpc/triple/pb/dubbogo-grpc/grpc-server/main.go b/rpc/triple/pb/dubbogo-grpc/grpc-server/main.go index d12fe3294..db3aa0615 100644 --- a/rpc/triple/pb/dubbogo-grpc/grpc-server/main.go +++ b/rpc/triple/pb/dubbogo-grpc/grpc-server/main.go @@ -55,21 +55,27 @@ func (s *GreeterProvider) SayHelloStream(svr pb.Greeter_SayHelloStreamServer) er } fmt.Printf("grpc GreeterProvider recv 2 user, name = %s\n", c2.Name) - svr.Send(&pb.User{ + err = svr.Send(&pb.User{ Name: "hello " + c.Name, Age: 18, Id: "123456789", }) + if err != nil { + return err + } c3, err := svr.Recv() if err != nil { return err } fmt.Printf("grpc GreeterProvider recv 3 user, name = %s\n", c3.Name) - svr.Send(&pb.User{ + err = svr.Send(&pb.User{ Name: "hello " + c2.Name, Age: 19, Id: "123456789", }) + if err != nil { + return err + } return nil } diff --git a/rpc/triple/pb/dubbogo-java/go-client/cmd/client.go b/rpc/triple/pb/dubbogo-java/go-client/cmd/client.go index 8b76095b8..3d2beff58 100644 --- a/rpc/triple/pb/dubbogo-java/go-client/cmd/client.go +++ b/rpc/triple/pb/dubbogo-java/go-client/cmd/client.go @@ -27,6 +27,8 @@ import ( _ "dubbo.apache.org/dubbo-go/v3/imports" "github.com/dubbogo/gost/log" + + tripleConstant "github.com/dubbogo/triple/pkg/common/constant" ) import ( @@ -50,10 +52,8 @@ func main() { Name: "laurence", } - reply := &pb.User{} - ctx := context.Background() - ctx = context.WithValue(ctx, "tri-req-id", "test_value_XXXXXXXX") + ctx = context.WithValue(ctx, tripleConstant.TripleCtxKey("tri-req-id"), "test_value_XXXXXXXX") reply, err := grpcGreeterImpl.SayHello(ctx, req) if err != nil { diff --git a/rpc/triple/pb/dubbogo-java/go-client/conf/dubbogo.yml b/rpc/triple/pb/dubbogo-java/go-client/conf/dubbogo.yml index 617687043..638731f87 100644 --- a/rpc/triple/pb/dubbogo-java/go-client/conf/dubbogo.yml +++ b/rpc/triple/pb/dubbogo-java/go-client/conf/dubbogo.yml @@ -3,7 +3,7 @@ dubbo: zk: address: zookeeper://127.0.0.1:2181 consumer: - registryIDs: zk + registry-ids: zk references: GreeterClientImpl: protocol: tri diff --git a/rpc/triple/pb/dubbogo-java/go-server/cmd/server.go b/rpc/triple/pb/dubbogo-java/go-server/cmd/server.go index afcde09c8..9874e7f3a 100644 --- a/rpc/triple/pb/dubbogo-java/go-server/cmd/server.go +++ b/rpc/triple/pb/dubbogo-java/go-server/cmd/server.go @@ -53,7 +53,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) diff --git a/rpc/triple/pb/dubbogo-java/go-server/conf/dubbogo.yml b/rpc/triple/pb/dubbogo-java/go-server/conf/dubbogo.yml index 96c8d8478..3303aee78 100644 --- a/rpc/triple/pb/dubbogo-java/go-server/conf/dubbogo.yml +++ b/rpc/triple/pb/dubbogo-java/go-server/conf/dubbogo.yml @@ -7,9 +7,9 @@ dubbo: name: tri port: 20001 provider: - registryIDs: zk + registry-ids: zk services: GreeterProvider: - protocolIDs: triple + protocol-ids: triple # interface is for registry interface: org.apache.dubbo.demo.IGreeter \ No newline at end of file diff --git a/start_integrate_test.sh b/start_integrate_test.sh index ea963c604..d12fe1aed 100755 --- a/start_integrate_test.sh +++ b/start_integrate_test.sh @@ -21,6 +21,9 @@ array+=("game/go-server-gate") # route array=("route/meshroute") +# metrics +array+=("metrics") + # helloworld array+=("helloworld") diff --git a/tracing/dubbo/go-client/cmd/client.go b/tracing/dubbo/go-client/cmd/client.go index e9611dfb3..b6776593e 100644 --- a/tracing/dubbo/go-client/cmd/client.go +++ b/tracing/dubbo/go-client/cmd/client.go @@ -56,7 +56,9 @@ var ( func main() { hessian.RegisterPOJO(&pkg.User{}) config.SetConsumerService(userProvider) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } // initJaeger() and initZipkin() can only use one at the same time //initJaeger() initZipkin() @@ -75,7 +77,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, + signal.Notify(signals, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals @@ -95,6 +97,7 @@ func initSignal() { } } +// nolint func initJaeger() { cfg := jaegerConfig.Configuration{ ServiceName: "dobbugoJaegerTracingService", diff --git a/tracing/dubbo/go-client/conf/dubbogo.yml b/tracing/dubbo/go-client/conf/dubbogo.yml index 2784a621c..3200cde9d 100644 --- a/tracing/dubbo/go-client/conf/dubbogo.yml +++ b/tracing/dubbo/go-client/conf/dubbogo.yml @@ -8,7 +8,7 @@ dubbo: address: 127.0.0.1:2181 consumer: filter: tracing - registryIDs: + registry-ids: - demoZK references: UserProvider: diff --git a/tracing/dubbo/go-server/cmd/server.go b/tracing/dubbo/go-server/cmd/server.go index d8735d5a0..185138d9b 100644 --- a/tracing/dubbo/go-server/cmd/server.go +++ b/tracing/dubbo/go-server/cmd/server.go @@ -65,7 +65,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) @@ -84,6 +84,7 @@ func initSignal() { } } +// nolint func initJaeger() { cfg := jaegerConfig.Configuration{ ServiceName: "dobbugoJaegerTracingService", diff --git a/tracing/dubbo/go-server/conf/dubbogo.yml b/tracing/dubbo/go-server/conf/dubbogo.yml index d33ba7dbf..0d082e36d 100644 --- a/tracing/dubbo/go-server/conf/dubbogo.yml +++ b/tracing/dubbo/go-server/conf/dubbogo.yml @@ -12,11 +12,11 @@ dubbo: port: 20000 provider: filter: tracing - registryIDs: + registry-ids: - demoZK services: UserProvider: - protocolIDs: dubbo + protocol-ids: dubbo interface: org.apache.dubbo.UserProvider loadbalance: random warmup: 100 diff --git a/tracing/dubbo/go-server/pkg/user.go b/tracing/dubbo/go-server/pkg/user.go index e92e09ce4..2148bcfb2 100644 --- a/tracing/dubbo/go-server/pkg/user.go +++ b/tracing/dubbo/go-server/pkg/user.go @@ -53,7 +53,7 @@ type UserProvider struct { } func (u *UserProvider) GetUser(ctx context.Context, req *User) (*User, error) { - span, ctx := opentracing.StartSpanFromContext(ctx, "User-Server-Span") + span, _ := opentracing.StartSpanFromContext(ctx, "User-Server-Span") gxlog.CInfo("req:%#v", req) user := &User{Id: "001", Name: "zhangsan-dubbogo", Age: 18, Time: time.Now()} span.Finish() diff --git a/tracing/grpc/go-client/cmd/client.go b/tracing/grpc/go-client/cmd/client.go index c14986bd2..f40f41de3 100644 --- a/tracing/grpc/go-client/cmd/client.go +++ b/tracing/grpc/go-client/cmd/client.go @@ -57,7 +57,9 @@ func init() { } func main() { - config.Load() + if err := config.Load(); err != nil { + panic(err) + } // initJaeger() and initZipkin() can only use one at the same time initJaeger() //initZipkin() @@ -78,7 +80,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, + signal.Notify(signals, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals @@ -118,6 +120,7 @@ func initJaeger() { opentracing.SetGlobalTracer(nativeTracer) } +// nolint func initZipkin() { reporter := zipkinhttp.NewReporter("http://localhost:9411/api/v2/spans") endpoint, err := zipkin.NewEndpoint("dobbugoZipkinTracingService", "myservice.mydomain.com:80") diff --git a/tracing/grpc/go-client/conf/dubbogo.yml b/tracing/grpc/go-client/conf/dubbogo.yml index 715f51be1..f43352747 100644 --- a/tracing/grpc/go-client/conf/dubbogo.yml +++ b/tracing/grpc/go-client/conf/dubbogo.yml @@ -8,7 +8,7 @@ dubbo: address: 127.0.0.1:2181 consumer: filter: tracing - registryIDs: + registry-ids: - demoZK references: GreeterClientImpl: diff --git a/tracing/grpc/go-server/cmd/server.go b/tracing/grpc/go-server/cmd/server.go index 70ed546d0..b93ac1d21 100644 --- a/tracing/grpc/go-server/cmd/server.go +++ b/tracing/grpc/go-server/cmd/server.go @@ -55,7 +55,7 @@ type GreeterProvider struct { } func (g *GreeterProvider) SayHello(ctx context.Context, req *pb.HelloRequest) (reply *pb.HelloReply, err error) { - span, ctx := opentracing.StartSpanFromContext(ctx, "User-RPC-Server-Span") + span, _ := opentracing.StartSpanFromContext(ctx, "User-RPC-Server-Span") fmt.Printf("req: %v", req) reply = &pb.HelloReply{Message: "this is message from reply"} span.Finish() @@ -76,7 +76,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) @@ -116,6 +116,7 @@ func initJaeger() { opentracing.SetGlobalTracer(nativeTracer) } +// nolint func initZipkin() { reporter := zipkinhttp.NewReporter("http://localhost:9411/api/v2/spans") endpoint, err := zipkin.NewEndpoint("dobbugoZipkinTracingService", "myservice.mydomain.com:80") diff --git a/tracing/grpc/go-server/conf/dubbogo.yml b/tracing/grpc/go-server/conf/dubbogo.yml index e4ea54e3c..9dc2c5519 100644 --- a/tracing/grpc/go-server/conf/dubbogo.yml +++ b/tracing/grpc/go-server/conf/dubbogo.yml @@ -12,7 +12,7 @@ dubbo: port: 20000 provider: filter: tracing - registryIDs: + registry-ids: - demoZK services: GreeterProvider: diff --git a/tracing/jsonrpc/go-client/cmd/client.go b/tracing/jsonrpc/go-client/cmd/client.go index ce156f50d..b80edcfba 100644 --- a/tracing/jsonrpc/go-client/cmd/client.go +++ b/tracing/jsonrpc/go-client/cmd/client.go @@ -55,7 +55,9 @@ var ( func main() { config.SetConsumerService(userProvider) - config.Load(config.WithPath("./tracing/jsonrpc/go-client/conf/dubbogo.yml")) + if err := config.Load(config.WithPath("./tracing/jsonrpc/go-client/conf/dubbogo.yml")); err != nil { + panic(err) + } // initJaeger() and initZipkin() can only use one at the same time initJaeger() //initZipkin() @@ -74,7 +76,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) // It is not possible to block SIGKILL or syscall.SIGSTOP - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, + signal.Notify(signals, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals @@ -114,6 +116,7 @@ func initJaeger() { opentracing.SetGlobalTracer(nativeTracer) } +// nolint func initZipkin() { reporter := zipkinhttp.NewReporter("http://localhost:9411/api/v2/spans") endpoint, err := zipkin.NewEndpoint("dobbugoZipkinTracingService", "myservice.mydomain.com:80") diff --git a/tracing/jsonrpc/go-client/conf/dubbogo.yml b/tracing/jsonrpc/go-client/conf/dubbogo.yml index 8cd0dd73c..3e179f24c 100644 --- a/tracing/jsonrpc/go-client/conf/dubbogo.yml +++ b/tracing/jsonrpc/go-client/conf/dubbogo.yml @@ -8,11 +8,11 @@ dubbo: address: 127.0.0.1:2181 consumer: filter: tracing - registryIDs: + registry-ids: - demoZK references: UserProvider: - protocolIDs: jsonrpc + protocol-ids: jsonrpc interface: org.apache.dubbo.UserProvider cluster: failover \ No newline at end of file diff --git a/tracing/jsonrpc/go-server/cmd/server.go b/tracing/jsonrpc/go-server/cmd/server.go index bccb291f4..fd7220d40 100644 --- a/tracing/jsonrpc/go-server/cmd/server.go +++ b/tracing/jsonrpc/go-server/cmd/server.go @@ -51,7 +51,9 @@ var ( func main() { config.SetProviderService(new(pkg.UserProvider)) - config.Load() + if err := config.Load(); err != nil { + panic(err) + } // initJaeger() and initZipkin() can only use one at the same time initJaeger() //initZipkin() @@ -60,7 +62,7 @@ func main() { func initSignal() { signals := make(chan os.Signal, 1) - signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) + signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT) for { sig := <-signals logger.Infof("get signal %s", sig.String()) @@ -99,6 +101,7 @@ func initJaeger() { opentracing.SetGlobalTracer(nativeTracer) } +// nolint func initZipkin() { reporter := zipkinhttp.NewReporter("http://localhost:9411/api/v2/spans") endpoint, err := zipkin.NewEndpoint("dobbugoZipkinTracingService", "myservice.mydomain.com:80") diff --git a/tracing/jsonrpc/go-server/conf/dubbogo.yml b/tracing/jsonrpc/go-server/conf/dubbogo.yml index e92bfbb48..26625fd9e 100644 --- a/tracing/jsonrpc/go-server/conf/dubbogo.yml +++ b/tracing/jsonrpc/go-server/conf/dubbogo.yml @@ -13,11 +13,11 @@ dubbo: port: 20001 provider: filter: tracing - registryIDs: + registry-ids: - demoZK services: UserProvider: - protocolIDs: jsonrpc + protocol-ids: jsonrpc interface: org.apache.dubbo.UserProvider cluster: failover \ No newline at end of file diff --git a/tracing/jsonrpc/go-server/pkg/user.go b/tracing/jsonrpc/go-server/pkg/user.go index 3c23eef9c..b22ec66b8 100644 --- a/tracing/jsonrpc/go-server/pkg/user.go +++ b/tracing/jsonrpc/go-server/pkg/user.go @@ -41,7 +41,7 @@ type UserProvider struct { } func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) { - span, ctx := opentracing.StartSpanFromContext(ctx, "User-JsonRPC-Server-Span") + span, _ := opentracing.StartSpanFromContext(ctx, "User-JsonRPC-Server-Span") gxlog.CInfo("req:%#v", req) user := &User{Id: "001", Name: "zhangsan-dubbogo", Age: 18, Birth: time.Now()} span.Finish()