optimize code struct

This commit is contained in:
jianzhiyao 2021-05-14 11:23:49 +08:00 committed by GitHub
parent 2fdda76882
commit 7e15ea4169
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -618,7 +618,8 @@ func eq(arg1 interface{}, arg2 ...interface{}) (bool, error) {
default: default:
return false, errBadComparison return false, errBadComparison
} }
} else { return true, nil
}
switch k1 { switch k1 {
case boolKind: case boolKind:
truth = v1.Bool() == v2.Bool() truth = v1.Bool() == v2.Bool()
@ -633,12 +634,9 @@ func eq(arg1 interface{}, arg2 ...interface{}) (bool, error) {
case uintKind: case uintKind:
truth = v1.Uint() == v2.Uint() truth = v1.Uint() == v2.Uint()
default: default:
panic("invalid kind") return false, errBadComparisonType
}
}
if truth {
return true, nil
} }
return truth, nil
} }
return false, nil return false, nil
} }