iansmith / parigot

Develop as a monolith, deploy as microservices.
https://parigot.info
BSD 3-Clause "New" or "Revised" License
12 stars 1 forks source link

not fully typing the server definition in generated go code #3

Closed iansmith closed 1 year ago

iansmith commented 1 year ago

Currently, the code generator (protoc-gen-parigot) is generating something that is not attractive or convenient in the server side go code.

In template/go_/serverdecl.tmpl line 30 is always outputting the type proto.Message but it should be generating the specific type for that declaration. As it is, the user is forced to use a cast to get the parameter value into the proper type:

req := inProto.(*pb.LogRequest)

This defeats the purpose of generating code and the code generator has the type information.

iansmith commented 1 year ago

This is also true of the return values. They need to be changed to return a "correct" value which can then be downgraded in the implementation and away from user code.