From e3aa5bde23fe26cbb6711a6ffbf4856a23fa6f54 Mon Sep 17 00:00:00 2001 From: Jes Cok Date: Mon, 31 Jul 2023 00:01:37 +0800 Subject: [PATCH] text/template: use "IsValid" instead of "!= zero" to compare zero Value See CL #308769 --- src/text/template/funcs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 } }