mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 06:42:16 +00:00
fix gocritic issues
This commit is contained in:
parent
1904e777f7
commit
a11fd8c67b
@ -241,12 +241,13 @@ func makeHTTPDialer(remoteAddr string) (string, string, func(string, string) (ne
|
|||||||
|
|
||||||
parts := strings.SplitN(remoteAddr, "://", 2)
|
parts := strings.SplitN(remoteAddr, "://", 2)
|
||||||
var protocol, address string
|
var protocol, address string
|
||||||
if len(parts) == 1 {
|
switch len(parts) {
|
||||||
|
case 1:
|
||||||
// default to tcp if nothing specified
|
// default to tcp if nothing specified
|
||||||
protocol, address = protoTCP, remoteAddr
|
protocol, address = protoTCP, remoteAddr
|
||||||
} else if len(parts) == 2 {
|
case 2:
|
||||||
protocol, address = parts[0], parts[1]
|
protocol, address = parts[0], parts[1]
|
||||||
} else {
|
default:
|
||||||
// return a invalid message
|
// return a invalid message
|
||||||
msg := fmt.Sprintf("Invalid addr: %s", remoteAddr)
|
msg := fmt.Sprintf("Invalid addr: %s", remoteAddr)
|
||||||
return clientProtocol, msg, func(_ string, _ string) (net.Conn, error) {
|
return clientProtocol, msg, func(_ string, _ string) (net.Conn, error) {
|
||||||
|
@ -107,13 +107,14 @@ func jsonStringToArg(cdc *amino.Codec, rt reflect.Type, arg string) (reflect.Val
|
|||||||
func nonJSONStringToArg(cdc *amino.Codec, rt reflect.Type, arg string) (reflect.Value, error, bool) {
|
func nonJSONStringToArg(cdc *amino.Codec, rt reflect.Type, arg string) (reflect.Value, error, bool) {
|
||||||
if rt.Kind() == reflect.Ptr {
|
if rt.Kind() == reflect.Ptr {
|
||||||
rv_, err, ok := nonJSONStringToArg(cdc, rt.Elem(), arg)
|
rv_, err, ok := nonJSONStringToArg(cdc, rt.Elem(), arg)
|
||||||
if err != nil {
|
switch {
|
||||||
|
case err != nil:
|
||||||
return reflect.Value{}, err, false
|
return reflect.Value{}, err, false
|
||||||
} else if ok {
|
case ok:
|
||||||
rv := reflect.New(rt.Elem())
|
rv := reflect.New(rt.Elem())
|
||||||
rv.Elem().Set(rv_)
|
rv.Elem().Set(rv_)
|
||||||
return rv, nil, true
|
return rv, nil, true
|
||||||
} else {
|
default:
|
||||||
return reflect.Value{}, nil, false
|
return reflect.Value{}, nil, false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user