apache / dubbo-go-samples

Apache dubbo
https://dubbo.apache.org/
Apache License 2.0
235 stars 185 forks source link

Why call the `hessian.RegisterPOJO(&User{})` twice #71

Closed walkerxiong closed 3 years ago

walkerxiong commented 3 years ago

I have a doubt, why the function is called twice in the go-server pkg, is it necessary ? for example: helloworld/go-server/cmd/server.go

func main() {
>   hessian.RegisterPOJO(&pkg.User{})
    config.Load()

    initSignal()
}

but in the helloworld/pkg/user.go

func init() {
    config.SetProviderService(new(UserProvider))
    // ------for hessian2------
>   hessian.RegisterPOJO(&User{})
}
AlexStocks commented 3 years ago

It's a wrong guide. we should improve it.