fix: fix interface pointers

This commit is contained in:
franklin 2021-04-09 09:41:39 +02:00
parent 2cfc829714
commit e6d91c034e

9
go.go
View File

@ -495,6 +495,11 @@ func renderGoRPCServiceProxies(services ServiceList, fullPackageName string, pac
continue continue
} }
servicePointer := "*"
if service.IsInterface {
servicePointer = ""
}
proxyName := service.Name + "GoRPCProxy" proxyName := service.Name + "GoRPCProxy"
// Types // Types
g.l(`type (`) g.l(`type (`)
@ -502,7 +507,7 @@ func renderGoRPCServiceProxies(services ServiceList, fullPackageName string, pac
g.l(` g.l(`
` + proxyName + ` struct { ` + proxyName + ` struct {
server *gorpc.Server server *gorpc.Server
service *` + service.Name + ` service ` + servicePointer + service.Name + `
callStatsHandler gotsrpc.GoRPCCallStatsHandlerFun callStatsHandler gotsrpc.GoRPCCallStatsHandlerFun
} }
`) `)
@ -537,7 +542,7 @@ func renderGoRPCServiceProxies(services ServiceList, fullPackageName string, pac
g.l(`}`) g.l(`}`)
// Constructor // Constructor
g.l(` g.l(`
func New` + proxyName + `(addr string, service *` + service.Name + `, tlsConfig *tls.Config) *` + proxyName + ` { func New` + proxyName + `(addr string, service ` + servicePointer + service.Name + `, tlsConfig *tls.Config) *` + proxyName + ` {
proxy := &` + proxyName + `{ proxy := &` + proxyName + `{
service: service, service: service,
} }