From e71c4267e3df50e0ff134b6a1bbb83a292b3d51a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jochum?= Date: Wed, 9 Oct 2024 16:26:01 +0200 Subject: [PATCH] fix(server/drpc,server/grpc): lint errors. --- .trunk/trunk.yaml | 20 ++++++++++---------- server/drpc/handle_rpc.go | 4 ++-- server/grpc/interceptor.go | 14 +------------- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 841127df..6381bfd3 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -15,26 +15,26 @@ runtimes: - node@18.12.1 lint: enabled: - - osv-scanner@1.8.4 - - checkov@3.2.239 - - trivy@0.54.1 - - trufflehog@3.81.10 + - osv-scanner@1.9.0 + - checkov@3.2.257 + - trivy@0.56.1 + - trufflehog@3.82.7 - yamllint@1.35.1 - - actionlint@1.7.1 - - markdownlint@0.41.0 + - actionlint@1.7.3 + - markdownlint@0.42.0 - git-diff-check - - gitleaks@8.18.4 + - gitleaks@8.20.1 - gofmt@1.20.5 - - golangci-lint@1.60.3 + - golangci-lint@1.61.0 - prettier@3.3.3 disabled: - gokart - shellcheck - shfmt cli: - version: 1.22.4 + version: 1.22.6 plugins: sources: - id: trunk - ref: v1.6.2 + ref: v1.6.3 uri: https://github.com/trunk-io/plugins diff --git a/server/drpc/handle_rpc.go b/server/drpc/handle_rpc.go index 8cf49b0a..855c4344 100644 --- a/server/drpc/handle_rpc.go +++ b/server/drpc/handle_rpc.go @@ -92,10 +92,10 @@ func (m *Mux) HandleRPC(stream drpc.Stream, rpc string) (err error) { oErr := orberrors.From(err) if oErr.Wrapped != nil { - return drpcerr.WithCode(fmt.Errorf("%s: %s", oErr.Message, oErr.Wrapped.Error()), uint64(oErr.Code)) + return drpcerr.WithCode(fmt.Errorf("%s: %s", oErr.Message, oErr.Wrapped.Error()), uint64(oErr.Code)) //nolint:gosec } - return drpcerr.WithCode(errors.New(oErr.Message), uint64(oErr.Code)) + return drpcerr.WithCode(errors.New(oErr.Message), uint64(oErr.Code)) //nolint:gosec case out != nil && !reflect.ValueOf(out).IsNil(): outData, err := anypb.New(out.(proto.Message)) if err != nil { diff --git a/server/grpc/interceptor.go b/server/grpc/interceptor.go index b87cb73d..9612e6b9 100644 --- a/server/grpc/interceptor.go +++ b/server/grpc/interceptor.go @@ -81,19 +81,7 @@ func (s *Server) unaryServerInterceptor() grpc.UnaryServerInterceptor { } func (s *Server) streamServerInterceptor() grpc.StreamServerInterceptor { - return func(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { - // h := func(srv any, ss grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler) error { - // return handler(srv, ss) - // } - - // // Add user defined middleware if the route requires. - // if next := s.config.StreamInterceptors.Match(info.FullMethod); len(next) > 0 { - // next = append(next, h) - // h = chainStreamInterceptors(next) - // } - - // return h(srv, ss, info, handler) - + return func(srv any, ss grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler) error { return handler(srv, ss) } }