From: Jes Cok Date: Tue, 1 Aug 2023 13:28:14 +0000 (+0000) Subject: text/template: use "IsValid" instead of "!= zero" to compare zero Value X-Git-Tag: go1.22rc1~1429 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e4aec1fa8a9c57672b783d16dd122cb4e6708089;p=gostls13.git text/template: use "IsValid" instead of "!= zero" to compare zero Value See CL 308769 Change-Id: I0caa0a84215b3d4b8b3dc6f041b6cd9cbe2c0908 GitHub-Last-Rev: e3aa5bde23fe26cbb6711a6ffbf4856a23fa6f54 GitHub-Pull-Request: golang/go#61657 Reviewed-on: https://go-review.googlesource.com/c/go/+/514195 Run-TryBot: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: David Chase TryBot-Result: Gopher Robot Reviewed-by: Daniel Martí Reviewed-by: Rob Pike Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor --- diff --git a/src/text/template/funcs.go b/src/text/template/funcs.go index b5a8c9ec50..a949f896fa 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 } }