knqyf263 / go-plugin

Go Plugin System over WebAssembly
MIT License
578 stars 27 forks source link

Is using values instead of pointers is by design? #29

Closed inliquid closed 1 year ago

inliquid commented 1 year ago

I noticed that gen-go-pugin generates code which uses values, so the code looks like:

// The greeting service definition.
// go:plugin type=plugin version=1
type Greeter interface {
    SayHello(context.Context, GreetReq) (GreetResp, error)
}

While gRPC plugin generates this code from the same *.proto definition:

// GreeterClient is the client API for Greeter service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type GreeterClient interface {
    SayHello(ctx context.Context, in *GreetReq, opts ...grpc.CallOption) (*GreetResp, error)
}

This also makes gopls complain about copying of sync.Mutex: изображение

If it's by design, I would like to learn more about it.

codefromthecrypt commented 1 year ago

personally, I doubt this is by design and unless someone screams you can raise a PR to change it, worst case we can revert if get a late scream. This is a detail important to finalize before any 1.0

knqyf263 commented 1 year ago

Looks like we should change it to pointers.