Browse Source

fix lint error

pull/267/head
yedf2 4 years ago
parent
commit
8833ea517e
  1. 5
      dtmcli/dtmimp/consts.go
  2. 2
      dtmsvr/trans_class.go
  3. 4
      dtmsvr/trans_status.go

5
dtmcli/dtmimp/consts.go

@ -55,4 +55,9 @@ const (
// XaBarrier1 const for xa barrier id
XaBarrier1 = "01"
// ProtocolGRPC const for protocol grpc
ProtocolGRPC = "grpc"
// ProtocolHTTP const for protocol http
ProtocolHTTP = "http"
)

2
dtmsvr/trans_class.go

@ -31,7 +31,7 @@ func (t *TransGlobal) setupPayloads() {
}
}
if t.Protocol == "" {
t.Protocol = "http"
t.Protocol = dtmimp.ProtocolHTTP
}
}

4
dtmsvr/trans_status.go

@ -89,7 +89,7 @@ func (t *TransGlobal) getURLResult(uri string, branchID, op string, branchPayloa
if uri == "" { // empty url is success
return nil
}
if t.Protocol == "http" || strings.HasPrefix(uri, "http://") || strings.HasPrefix(uri, "https://") {
if t.Protocol == dtmimp.ProtocolHTTP || strings.HasPrefix(uri, "http://") || strings.HasPrefix(uri, "https://") {
if t.RequestTimeout != 0 {
dtmimp.RestyClient.SetTimeout(time.Duration(t.RequestTimeout) * time.Second)
}
@ -146,7 +146,7 @@ func (t *TransGlobal) getURLResult(uri string, branchID, op string, branchPayloa
}
return dtmimp.RespAsErrorCompatible(resp)
}
dtmimp.PanicIf(t.Protocol == "http", fmt.Errorf("bad url for http: %s", uri))
dtmimp.PanicIf(t.Protocol == dtmimp.ProtocolHTTP, fmt.Errorf("bad url for http: %s", uri))
// grpc handler
server, method, err := dtmdriver.GetDriver().ParseServerMethod(uri)
if err != nil {

Loading…
Cancel
Save