From 1b296ec5b10d49688c1097d18a28bfc57becf444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E9=91=AB?= Date: Mon, 15 May 2023 21:20:42 +0800 Subject: [PATCH] fix(client): fix type assertion panic error --- client/workflow/workflow.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/workflow/workflow.go b/client/workflow/workflow.go index 3abed6a10..2695d862f 100644 --- a/client/workflow/workflow.go +++ b/client/workflow/workflow.go @@ -235,11 +235,11 @@ func (wf *Workflow) DoXa(dbConf dtmcli.DBConf, fn func(db *sql.DB) ([]byte, erro // Interceptor is the middleware for workflow to capture grpc call result func Interceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { logger.Debugf("grpc client calling: %s%s %v", cc.Target(), method, dtmimp.MustMarshalString(req)) - wf, _ := ctx.Value(wfMeta{}).(*Workflow) - if wf == nil { + wfVal := ctx.Value(wfMeta{}) + if wfVal == nil { return invoker(ctx, method, req, reply, cc, opts...) } - + wf, _ := wfVal.(*Workflow) origin := func() error { ctx1 := dtmgimp.TransInfo2Ctx(ctx, wf.Gid, wf.TransType, wf.currentBranch, wf.currentOp, wf.Dtm) err := invoker(ctx1, method, req, reply, cc, opts...)