cannot use transformer.NewTransformer(zrpc.MustNewClient(c.Transform)) (type transformer.Transformer) as type zrpc.RpcClientConf in field value
Kevin-Ben opened this issue · 3 comments
internal/svc/servicecontext.go:17:3: cannot use transformer.NewTransformer(zrpc.MustNewClient(c.Transform)) (type transformer.Transformer) as type zrpc.RpcClientConf in field value
@Kevin-Ben Please upgrade goctl to the latest version, the part of output in rpc/transform/transformer/transformer.go
should like the following codes after execute command goctl rpc proto -src transform.proto -dir .
type (
ExpandReq = transform.ExpandReq
ExpandResp = transform.ExpandResp
ShortenReq = transform.ShortenReq
ShortenResp = transform.ShortenResp
Transformer interface {
Expand(ctx context.Context, in *ExpandReq) (*ExpandResp, error)
Shorten(ctx context.Context, in *ShortenReq) (*ShortenResp, error)
}
defaultTransformer struct {
cli zrpc.Client
}
)
func NewTransformer(cli zrpc.Client) Transformer {
return &defaultTransformer{
cli: cli,
}
}
the function NewTransformer
expects to return a interface named Transformer
, but not a struct named Transformer
, if it returns a struct named Transformer
, upgrade goctl to the latest and try the demo again, you will see it fixed.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.