The parameter name srv in StreamServerInterceptor is confusing because:
- In unary interceptors, the service implementation is clearly named Server (
UnaryServerInfo.Server).
- In stream interceptors, it’s passed as srv any with no comment.
- Because the type is any and there’s no documentation, it’s unclear whether srv is the same thing as
UnaryServerInfo.Server or something different.
Is srv just a shorthand for "server", or is there a semantic difference?
To improve clarity, I suggest adding a short comment that explicitly states what srv is.
// srv is the service implementation the user provides.
type StreamServerInterceptor func(srv any, ss ServerStream, info *StreamServerInfo, handler StreamHandler) error
The parameter name
srvin StreamServerInterceptor is confusing because:UnaryServerInfo.Server).UnaryServerInfo.Serveror something different.Is
srvjust a shorthand for "server", or is there a semantic difference?To improve clarity, I suggest adding a short comment that explicitly states what
srvis.