enable to create protocol buffer messages dynamically from proto files #867
reviewdog [golangci] report
reported by reviewdog 🐶
Findings (22)
mock/protocol/grpc/handler.go|256 col 19| G115: integer overflow conversion int -> uint32 (gosec)
mock/protocol/grpc/handler_test.go|25 col 23| resovle
is a misspelling of resolve
(misspell)
mock/protocol/grpc/handler_test.go|142 col 12| reponse
is a misspelling of response
(misspell)
mock/protocol/grpc/handler_test.go|155 col 12| reponse
is a misspelling of response
(misspell)
protocol/grpc/request_custom_client.go|26 col 77| unused-parameter: parameter 'opts' seems to be unused, consider removing or renaming it as _ (revive)
assert/nop.go|5 col 28| unused-parameter: parameter 'v' seems to be unused, consider removing or renaming it as _ (revive)
mock/protocol/grpc/handler.go|55 col 14| unused-parameter: parameter 'srv' seems to be unused, consider removing or renaming it as _ (revive)
mock/protocol/grpc/handler.go|69 col 40| Function New
should pass the context parameter (contextcheck)
mock/protocol/grpc/handler.go|95 col 22| Function New
should pass the context parameter (contextcheck)
mock/protocol/grpc/handler.go|96 col 33| Function ExecuteTemplate
should pass the context parameter (contextcheck)
mock/protocol/grpc/grpc.go|52 col 10| grpc.server is missing fields m, config, resolver, addr, srv (exhaustruct)
mock/protocol/grpc/handler.go|28 col 11| grpc.ServiceDesc is missing fields HandlerType, Methods, Streams (exhaustruct)
protocol/grpc/request.go|100 col 11| grpc.RequestOptions is missing field Reflection (exhaustruct)
protocol/grpc/request_custom_client.go|156 col 11| grpc.response is missing fields Header, Trailer (exhaustruct)
protocol/grpc/proto/proto.go|33 col 15| protocompile.Compiler is missing fields MaxParallelism, Reporter, SourceInfoMode, RetainASTs, Symbols (exhaustruct)
protocol/grpc/proto/proto.go|34 col 47| protocompile.SourceResolver is missing field Accessor (exhaustruct)
protocol/grpc/request.go|121 col 9| interface method invoke must have all named params (inamedparam)
protocol/grpc/proto/proto.go|16 col 17| interface method ResolveService must have named param for type protoreflect.FullName (inamedparam)
protocol/grpc/request_custom_client.go|89 col 1| Function name: invoke, Cyclomatic Complexity: 23, Halstead Volume: 3880.41, Maintainability Index: 26 (maintidx)
protocol/grpc/request_custom_client.go|73 col 16| Magic number: 2, in detected (mnd)
protocol/grpc/request_custom_client.go|64 col 27| Magic number: 3, in detected (mnd)
protocol/grpc/request_custom_client.go|76 col 28| Magic number: 2, in detected (mnd)
Filtered Findings (0)
Annotations
Check failure on line 256 in mock/protocol/grpc/handler.go
github-actions / golangci
[golangci] mock/protocol/grpc/handler.go#L256
G115: integer overflow conversion int -> uint32 (gosec)
Raw output
mock/protocol/grpc/handler.go:256:19: G115: integer overflow conversion int -> uint32 (gosec)
return codes.Code(i), nil
^
Check failure on line 25 in mock/protocol/grpc/handler_test.go
github-actions / golangci
[golangci] mock/protocol/grpc/handler_test.go#L25
`resovle` is a misspelling of `resolve` (misspell)
Raw output
mock/protocol/grpc/handler_test.go:25:23: `resovle` is a misspelling of `resolve` (misspell)
t.Fatalf("failed to resovle service: %s", err)
^
Check failure on line 142 in mock/protocol/grpc/handler_test.go
github-actions / golangci
[golangci] mock/protocol/grpc/handler_test.go#L142
`reponse` is a misspelling of `response` (misspell)
Raw output
mock/protocol/grpc/handler_test.go:142:12: `reponse` is a misspelling of `response` (misspell)
"invalid reponse status code": {
^
Check failure on line 155 in mock/protocol/grpc/handler_test.go
github-actions / golangci
[golangci] mock/protocol/grpc/handler_test.go#L155
`reponse` is a misspelling of `response` (misspell)
Raw output
mock/protocol/grpc/handler_test.go:155:12: `reponse` is a misspelling of `response` (misspell)
"invalid reponse message": {
^
Check failure on line 26 in protocol/grpc/request_custom_client.go
github-actions / golangci
[golangci] protocol/grpc/request_custom_client.go#L26
unused-parameter: parameter 'opts' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
protocol/grpc/request_custom_client.go:26:77: unused-parameter: parameter 'opts' seems to be unused, consider removing or renaming it as _ (revive)
func (client *customServiceClient) invoke(ctx *context.Context, r *Request, opts *RequestOptions) (*context.Context, *response, error) {
^
Check failure on line 5 in assert/nop.go
github-actions / golangci
[golangci] assert/nop.go#L5
unused-parameter: parameter 'v' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
assert/nop.go:5:28: unused-parameter: parameter 'v' seems to be unused, consider removing or renaming it as _ (revive)
return AssertionFunc(func(v interface{}) error {
^
Check failure on line 55 in mock/protocol/grpc/handler.go
github-actions / golangci
[golangci] mock/protocol/grpc/handler.go#L55
unused-parameter: parameter 'srv' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
mock/protocol/grpc/handler.go:55:14: unused-parameter: parameter 'srv' seems to be unused, consider removing or renaming it as _ (revive)
return func(srv any, ctx gocontext.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
^
Check failure on line 69 in mock/protocol/grpc/handler.go
github-actions / golangci
[golangci] mock/protocol/grpc/handler.go#L69
Function `New` should pass the context parameter (contextcheck)
Raw output
mock/protocol/grpc/handler.go:69:40: Function `New` should pass the context parameter (contextcheck)
assertion, err := e.build(context.New(nil))
^
Check failure on line 95 in mock/protocol/grpc/handler.go
github-actions / golangci
[golangci] mock/protocol/grpc/handler.go#L95
Function `New` should pass the context parameter (contextcheck)
Raw output
mock/protocol/grpc/handler.go:95:22: Function `New` should pass the context parameter (contextcheck)
sctx := context.New(nil)
^
Check failure on line 96 in mock/protocol/grpc/handler.go
github-actions / golangci
[golangci] mock/protocol/grpc/handler.go#L96
Function `ExecuteTemplate` should pass the context parameter (contextcheck)
Raw output
mock/protocol/grpc/handler.go:96:33: Function `ExecuteTemplate` should pass the context parameter (contextcheck)
v, err := sctx.ExecuteTemplate(resp)
^
Check failure on line 52 in mock/protocol/grpc/grpc.go
github-actions / golangci
[golangci] mock/protocol/grpc/grpc.go#L52
grpc.server is missing fields m, config, resolver, addr, srv (exhaustruct)
Raw output
mock/protocol/grpc/grpc.go:52:10: grpc.server is missing fields m, config, resolver, addr, srv (exhaustruct)
srv := &server{
^
Check failure on line 28 in mock/protocol/grpc/handler.go
github-actions / golangci
[golangci] mock/protocol/grpc/handler.go#L28
grpc.ServiceDesc is missing fields HandlerType, Methods, Streams (exhaustruct)
Raw output
mock/protocol/grpc/handler.go:28:11: grpc.ServiceDesc is missing fields HandlerType, Methods, Streams (exhaustruct)
desc := &grpc.ServiceDesc{
^
Check failure on line 100 in protocol/grpc/request.go
github-actions / golangci
[golangci] protocol/grpc/request.go#L100
grpc.RequestOptions is missing field Reflection (exhaustruct)
Raw output
protocol/grpc/request.go:100:11: grpc.RequestOptions is missing field Reflection (exhaustruct)
opts := &RequestOptions{}
^
Check failure on line 156 in protocol/grpc/request_custom_client.go
github-actions / golangci
[golangci] protocol/grpc/request_custom_client.go#L156
grpc.response is missing fields Header, Trailer (exhaustruct)
Raw output
protocol/grpc/request_custom_client.go:156:11: grpc.response is missing fields Header, Trailer (exhaustruct)
resp := &response{
^
Check failure on line 33 in protocol/grpc/proto/proto.go
github-actions / golangci
[golangci] protocol/grpc/proto/proto.go#L33
protocompile.Compiler is missing fields MaxParallelism, Reporter, SourceInfoMode, RetainASTs, Symbols (exhaustruct)
Raw output
protocol/grpc/proto/proto.go:33:15: protocompile.Compiler is missing fields MaxParallelism, Reporter, SourceInfoMode, RetainASTs, Symbols (exhaustruct)
compiler := &protocompile.Compiler{
^
Check failure on line 34 in protocol/grpc/proto/proto.go
github-actions / golangci
[golangci] protocol/grpc/proto/proto.go#L34
protocompile.SourceResolver is missing field Accessor (exhaustruct)
Raw output
protocol/grpc/proto/proto.go:34:47: protocompile.SourceResolver is missing field Accessor (exhaustruct)
Resolver: protocompile.WithStandardImports(&protocompile.SourceResolver{
^
Check failure on line 121 in protocol/grpc/request.go
github-actions / golangci
[golangci] protocol/grpc/request.go#L121
interface method invoke must have all named params (inamedparam)
Raw output
protocol/grpc/request.go:121:9: interface method invoke must have all named params (inamedparam)
invoke(*context.Context, *Request, *RequestOptions) (*context.Context, *response, error)
^
Check failure on line 16 in protocol/grpc/proto/proto.go
github-actions / golangci
[golangci] protocol/grpc/proto/proto.go#L16
interface method ResolveService must have named param for type protoreflect.FullName (inamedparam)
Raw output
protocol/grpc/proto/proto.go:16:17: interface method ResolveService must have named param for type protoreflect.FullName (inamedparam)
ResolveService(protoreflect.FullName) (protoreflect.ServiceDescriptor, error)
^
Check failure on line 89 in protocol/grpc/request_custom_client.go
github-actions / golangci
[golangci] protocol/grpc/request_custom_client.go#L89
Function name: invoke, Cyclomatic Complexity: 23, Halstead Volume: 3880.41, Maintainability Index: 26 (maintidx)
Raw output
protocol/grpc/request_custom_client.go:89:1: Function name: invoke, Cyclomatic Complexity: 23, Halstead Volume: 3880.41, Maintainability Index: 26 (maintidx)
func invoke(ctx *context.Context, method reflect.Value, r *Request) (*context.Context, *response, error) {
^
Check failure on line 73 in protocol/grpc/request_custom_client.go
github-actions / golangci
[golangci] protocol/grpc/request_custom_client.go#L73
Magic number: 2, in <argument> detected (mnd)
Raw output
protocol/grpc/request_custom_client.go:73:16: Magic number: 2, in <argument> detected (mnd)
if t := mt.In(2); t != typeCallOpts {
^
Check failure on line 64 in protocol/grpc/request_custom_client.go
github-actions / golangci
[golangci] protocol/grpc/request_custom_client.go#L64
Magic number: 3, in <condition> detected (mnd)
Raw output
protocol/grpc/request_custom_client.go:64:27: Magic number: 3, in <condition> detected (mnd)
if n := mt.NumIn(); n != 3 {
^
Check failure on line 76 in protocol/grpc/request_custom_client.go
github-actions / golangci
[golangci] protocol/grpc/request_custom_client.go#L76
Magic number: 2, in <condition> detected (mnd)
Raw output
protocol/grpc/request_custom_client.go:76:28: Magic number: 2, in <condition> detected (mnd)
if n := mt.NumOut(); n != 2 {
^