From d30daa959c4427fd35bb363f0e691d9bbd27d822 Mon Sep 17 00:00:00 2001 From: xyctruth <398041993@qq.com> Date: Thu, 23 Jun 2022 18:19:42 +0800 Subject: [PATCH] fix go lint --- dtmcli/dtmimp/utils.go | 4 ++-- dtmsvr/trans_status.go | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dtmcli/dtmimp/utils.go b/dtmcli/dtmimp/utils.go index 363c98c..93dd1fb 100644 --- a/dtmcli/dtmimp/utils.go +++ b/dtmcli/dtmimp/utils.go @@ -233,8 +233,8 @@ func RespAsErrorCompatible(resp *resty.Response) error { return nil } -// JsonRpcRespAsError translate json rpc resty response to error -func JsonRpcRespAsError(resp *resty.Response) error { +// RespAsErrorByJSONRPC translate json rpc resty response to error +func RespAsErrorByJSONRPC(resp *resty.Response) error { str := resp.String() var result map[string]interface{} MustUnmarshalString(str, &result) diff --git a/dtmsvr/trans_status.go b/dtmsvr/trans_status.go index 80350e7..eb47f7e 100644 --- a/dtmsvr/trans_status.go +++ b/dtmsvr/trans_status.go @@ -113,14 +113,14 @@ func (t *TransGlobal) getURLResult(uri string, branchID, op string, branchPayloa dtmimp.RestyClient.SetTimeout(time.Duration(t.RequestTimeout) * time.Second) } if t.Protocol == "json-rpc" && strings.Contains(uri, "method") { - return t.getJsonRpcResult(uri, branchID, op, branchPayload) + return t.getJSONRPCResult(uri, branchID, op, branchPayload) } - return t.getHttpResult(uri, branchID, op, branchPayload) + return t.getHTTPResult(uri, branchID, op, branchPayload) } return t.getGrpcResult(uri, branchID, op, branchPayload) } -func (t *TransGlobal) getHttpResult(uri string, branchID, op string, branchPayload []byte) error { +func (t *TransGlobal) getHTTPResult(uri string, branchID, op string, branchPayload []byte) error { resp, err := dtmimp.RestyClient.R().SetBody(string(branchPayload)). SetQueryParams(map[string]string{ "gid": t.Gid, @@ -138,7 +138,7 @@ func (t *TransGlobal) getHttpResult(uri string, branchID, op string, branchPaylo return dtmimp.RespAsErrorCompatible(resp) } -func (t *TransGlobal) getJsonRpcResult(uri string, branchID, op string, branchPayload []byte) error { +func (t *TransGlobal) getJSONRPCResult(uri string, branchID, op string, branchPayload []byte) error { var params map[string]interface{} dtmimp.MustUnmarshal(branchPayload, ¶ms) u, err := url.Parse(uri) @@ -161,7 +161,7 @@ func (t *TransGlobal) getJsonRpcResult(uri string, branchID, op string, branchPa err = dtmimp.RespAsErrorCompatible(resp) } if err == nil { - err = dtmimp.JsonRpcRespAsError(resp) + err = dtmimp.RespAsErrorByJSONRPC(resp) } return err }