From 370a1585a58db6cbdd93e21915caef6c123aae52 Mon Sep 17 00:00:00 2001 From: haiyux Date: Fri, 18 Feb 2022 17:13:41 +0800 Subject: [PATCH] fix: fix the latest version of lint problem (#1825) --- cmd/kratos/internal/proto/client/client.go | 2 +- cmd/kratos/internal/upgrade/upgrade.go | 1 - transport/grpc/client_test.go | 6 ++---- transport/grpc/server_test.go | 11 +++++------ 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/cmd/kratos/internal/proto/client/client.go b/cmd/kratos/internal/proto/client/client.go index 5dc9b2f66..8bc006336 100644 --- a/cmd/kratos/internal/proto/client/client.go +++ b/cmd/kratos/internal/proto/client/client.go @@ -39,7 +39,7 @@ func run(cmd *cobra.Command, args []string) { err error proto = strings.TrimSpace(args[0]) ) - if err = look("protoc-gen-go", "protoc-gen-go-grpc", "protoc-gen-go-http", "protoc-gen-go-errors", "protoc-gen-validate", "protoc-gen-openapi"); err != nil { + if err = look("protoc-gen-go", "protoc-gen-go-grpc", "protoc-gen-go-http", "protoc-gen-go-errors", "protoc-gen-openapi"); err != nil { // update the kratos plugins cmd := exec.Command("kratos", "upgrade") cmd.Stdout = os.Stdout diff --git a/cmd/kratos/internal/upgrade/upgrade.go b/cmd/kratos/internal/upgrade/upgrade.go index e93aae4a6..a8825dcc1 100644 --- a/cmd/kratos/internal/upgrade/upgrade.go +++ b/cmd/kratos/internal/upgrade/upgrade.go @@ -24,7 +24,6 @@ func Run(cmd *cobra.Command, args []string) { "github.com/go-kratos/kratos/cmd/protoc-gen-go-errors/v2@latest", "google.golang.org/protobuf/cmd/protoc-gen-go@latest", "google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest", - "github.com/envoyproxy/protoc-gen-validate@latest", "github.com/google/gnostic/cmd/protoc-gen-openapi@latest", ) if err != nil { diff --git a/transport/grpc/client_test.go b/transport/grpc/client_test.go index 034f01e41..1443b9b84 100644 --- a/transport/grpc/client_test.go +++ b/transport/grpc/client_test.go @@ -104,12 +104,10 @@ func TestUnaryClientInterceptor(t *testing.T) { func TestWithUnaryInterceptor(t *testing.T) { o := &clientOptions{} v := []grpc.UnaryClientInterceptor{ - func(ctx context.Context, method string, req, reply interface{}, - cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { return nil }, - func(ctx context.Context, method string, req, reply interface{}, - cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { return nil }, } diff --git a/transport/grpc/server_test.go b/transport/grpc/server_test.go index aaa6aca10..b4893186f 100644 --- a/transport/grpc/server_test.go +++ b/transport/grpc/server_test.go @@ -53,8 +53,7 @@ func TestServer(t *testing.T) { return handler(ctx, req) } }), - UnaryInterceptor(func(ctx context.Context, req interface{}, - info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) { + UnaryInterceptor(func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) { return handler(ctx, req) }), Options(grpc.InitialConnWindowSize(0)), @@ -85,10 +84,10 @@ func testClient(t *testing.T, srv *Server) { conn, err := DialInsecure(context.Background(), WithEndpoint(u.Host), WithOptions(grpc.WithBlock()), - WithUnaryInterceptor(func(ctx context.Context, method string, req, reply interface{}, - cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { - return invoker(ctx, method, req, reply, cc, opts...) - }), + WithUnaryInterceptor( + func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + return invoker(ctx, method, req, reply, cc, opts...) + }), WithMiddleware(func(handler middleware.Handler) middleware.Handler { return func(ctx context.Context, req interface{}) (reply interface{}, err error) { if tr, ok := transport.FromClientContext(ctx); ok {