GrantZheng / kit

GoKit CLI
MIT License
268 stars 54 forks source link

Why not encode/decode endpoint req&rsp as a pointer type? #13

Closed chaseSpace closed 3 years ago

chaseSpace commented 4 years ago
// SayHi implements Service. Primarily useful in a client.
func (e Endpoints) SayHi(ctx context.Context, name string) (reply string, err error) {
    request := SayHiRequest{
        Name: name,
    }
    response, err := e.SayHiEndpoint(ctx, request)
    if err != nil {
        return
    }
    return response.(SayHiResponse).Reply, response.(SayHiResponse).Err
}

The above is the an endpoint code generated by kit,both req&rsp aren't pointer type,why is it? I think convert req&rsp to pointer type is better way, it avoids value copy, isn't it ?

chaseSpace commented 4 years ago

If you agree my view, I will submit a PR to improve it.

GrantZheng commented 4 years ago

If you agree my view, I will submit a PR to improve it.

Hi, I agree with you,you could submit a PR, thanks for your effort :)

chaseSpace commented 4 years ago

That's great!