mirror of https://github.com/golang/go.git
text/template: use "IsValid" instead of "!= zero" to compare zero Value
See CL #308769
This commit is contained in:
parent
457721cd52
commit
e3aa5bde23
|
|
@ -478,7 +478,7 @@ func eq(arg1 reflect.Value, arg2 ...reflect.Value) (bool, error) {
|
||||||
case k1 == uintKind && k2 == intKind:
|
case k1 == uintKind && k2 == intKind:
|
||||||
truth = arg.Int() >= 0 && arg1.Uint() == uint64(arg.Int())
|
truth = arg.Int() >= 0 && arg1.Uint() == uint64(arg.Int())
|
||||||
default:
|
default:
|
||||||
if arg1 != zero && arg != zero {
|
if arg1.IsValid() && arg.IsValid() {
|
||||||
return false, errBadComparison
|
return false, errBadComparison
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue