diff --git a/src/text/template/funcs.go b/src/text/template/funcs.go index b5a8c9ec50a..a949f896fa3 100644 --- a/src/text/template/funcs.go +++ b/src/text/template/funcs.go @@ -478,7 +478,7 @@ func eq(arg1 reflect.Value, arg2 ...reflect.Value) (bool, error) { case k1 == uintKind && k2 == intKind: truth = arg.Int() >= 0 && arg1.Uint() == uint64(arg.Int()) default: - if arg1 != zero && arg != zero { + if arg1.IsValid() && arg.IsValid() { return false, errBadComparison } }