Shuixiang opened a new issue, #2173: URL: https://github.com/apache/dubbo-go/issues/2173
## When I run the client got the errors by logger info: > how can i fix this though it can request and got response, seems correctly ### client side:  ### server side:  ### dubbo-go version > when i use v3.0.2 it occurs problem like #2106 , so i upgrade the package to v3.0.4-rc1 then i got the errors above v3.0.4-rc1 ### system windows 11 ### ide vscode 1.74.2 ### codes #### common api.go ```golang // api.go package api import ( "context" "time" "dubbo.apache.org/dubbo-go/v3/config" hessian "github.com/apache/dubbo-go-hessian2" ) type User struct { Id string Name string Age int32 Time time.Time } func (u *User) JavaClassName() string { return "org.apache.dubbo.User" } type UserProvider struct { GetUser func(ctx context.Context, req int32) (*User, error) // dubbo:"getUser" } var ( UserProviderClient = &UserProvider{} ) func init() { hessian.RegisterPOJO(&User{}) config.SetConsumerService(UserProviderClient) } ``` #### server config dubbogo.yml ```yaml dubbo: registries: demoZK: protocol: zookeeper address: 127.0.0.1:2181 protocols: dubbo: name: dubbo port: 20000 provider: services: UserProvider: interface: org.apache.dubbo.UserProvider ``` #### server.go ```golang package main import ( "context" "dubbo3-demo/api" "strconv" "time" "dubbo.apache.org/dubbo-go/v3/config" "github.com/dubbogo/gost/log/logger" _ "dubbo.apache.org/dubbo-go/v3/imports" ) type UserProvider struct { } func (u *UserProvider) GetUser(ctx context.Context, req int32) (*api.User, error) { var err error logger.Infof("req:%#v", req) user := &api.User{} user.Id = strconv.Itoa(int(req)) user.Name = "laurence" user.Age = 22 user.Time = time.Now() return user, err } func init() { config.SetProviderService(&UserProvider{}) } // export DUBBO_GO_CONFIG_PATH=dubbogo.yml func main() { if err := config.Load(); err != nil { panic(err) } select {} } ``` #### client config dubbogo.yml ```yaml dubbo: registries: demoZK: protocol: zookeeper address: 127.0.0.1:2181 consumer: references: UserProvider: protocol: dubbo interface: org.apache.dubbo.UserProvider ``` #### client.go ```golang package main import ( "context" "dubbo3-demo-client/api" "dubbo.apache.org/dubbo-go/v3/config" _ "dubbo.apache.org/dubbo-go/v3/imports" "github.com/dubbogo/gost/log/logger" ) // export DUBBO_GO_CONFIG_PATH=dubbogo.yml func main() { if err := config.Load(); err != nil { panic(err) } var i int32 = 100000 user, err := api.UserProviderClient.GetUser(context.TODO(), i) if err != nil { panic(err) } logger.Infof("response result: %+v", user) } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
