]> Cypherpunks repositories - gostls13.git/commit
text/template: compare reflect.Value instances differently
authorKeith Randall <khr@golang.org>
Fri, 9 Apr 2021 00:06:29 +0000 (17:06 -0700)
committerDaniel Martí <mvdan@mvdan.cc>
Mon, 22 Aug 2022 11:46:15 +0000 (11:46 +0000)
commit9a9aad449fddb1d3f66e6200d2c6c63a0eed63a4
treed3575fe05364624872fb1ab2c0bc58424dbd877e
parent8d57f4dcef5d69a0a3f807afaa9625018569010b
text/template: compare reflect.Value instances differently

To avoid false positives from the reflectvaluecompare checker #43993

Use v.IsValid() instead of

var zero reflect.Value
v != zero

Also avoid comparing directly with the singleton reflect.Value
representing a missing value. Detect the missing value by type instead.

Change-Id: I3a00d63cf61c077e7c7ae816474aa1f032be325b
Reviewed-on: https://go-review.googlesource.com/c/go/+/308769
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/text/template/exec.go
src/text/template/funcs.go