fix: fix the latest version of lint problem (#1825)

pull/1826/head
haiyux 3 years ago committed by GitHub
parent cde962a6c1
commit 370a1585a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cmd/kratos/internal/proto/client/client.go
  2. 1
      cmd/kratos/internal/upgrade/upgrade.go
  3. 6
      transport/grpc/client_test.go
  4. 11
      transport/grpc/server_test.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

@ -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 {

@ -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
},
}

@ -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 {

Loading…
Cancel
Save