diff options
| author | pgxiaolianzi <gnnu_d13@163.com> | 2025-02-07 08:37:50 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-02-10 08:21:56 -0800 |
| commit | 181cf3c95ec99a44babb0e64c8f66956d2ac3a78 (patch) | |
| tree | 1f13ee619515c829fe14a2e15f608685dc403f4d /src/text/template/exec.go | |
| parent | ae26a30bb0cda77799334152a85eb63bb5cce0dc (diff) | |
| download | go-181cf3c95ec99a44babb0e64c8f66956d2ac3a78.tar.xz | |
text/template: handle UnsafePointer in isTrue
Change-Id: I4d0b5919d109f768ba04ab519e8f948a5749a752
GitHub-Last-Rev: 6f27f1193c21bb10e3b81660b4271f2c1f33be1e
GitHub-Pull-Request: golang/go#70520
Reviewed-on: https://go-review.googlesource.com/c/go/+/631076
Run-TryBot: Rob Pike <r@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/text/template/exec.go')
| -rw-r--r-- | src/text/template/exec.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/text/template/exec.go b/src/text/template/exec.go index ed6ae43671..7a67ec6824 100644 --- a/src/text/template/exec.go +++ b/src/text/template/exec.go @@ -333,7 +333,7 @@ func isTrue(val reflect.Value) (truth, ok bool) { truth = val.Bool() case reflect.Complex64, reflect.Complex128: truth = val.Complex() != 0 - case reflect.Chan, reflect.Func, reflect.Pointer, reflect.Interface: + case reflect.Chan, reflect.Func, reflect.Pointer, reflect.UnsafePointer, reflect.Interface: truth = !val.IsNil() case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: truth = val.Int() != 0 |
