aboutsummaryrefslogtreecommitdiff
path: root/src/text/template/exec.go
diff options
context:
space:
mode:
authorNodir Turakulov <nodir@google.com>2015-10-13 19:09:32 -0700
committerAndrew Gerrand <adg@golang.org>2015-10-15 05:02:27 +0000
commit167a7123997c42e91d69de2203fc4c156897f0a2 (patch)
treefaad77e26c53585413e6f65463fcdaf58a1fc73e /src/text/template/exec.go
parent65fc379daeda784d085f98d621a9ab712c096148 (diff)
downloadgo-167a7123997c42e91d69de2203fc4c156897f0a2.tar.xz
text/template: resolve non-empty interface
Read what a non-empty interface points to. The deleted lines were added in https://codereview.appspot.com/4810060/, which attempted to break an infinite loop. That was a long time ago. If I just delete these lines with current codebase, the test "bug1" (added in that CL) does not fail. All new tests fail without this fix. Fixes #12924 Change-Id: I9370ca44facd6af3019850aa065b936e5a482d37 Reviewed-on: https://go-review.googlesource.com/15809 Reviewed-by: Andrew Gerrand <adg@golang.org>
Diffstat (limited to 'src/text/template/exec.go')
-rw-r--r--src/text/template/exec.go5
1 files changed, 0 insertions, 5 deletions
diff --git a/src/text/template/exec.go b/src/text/template/exec.go
index 16839a8d6d..233d34a02b 100644
--- a/src/text/template/exec.go
+++ b/src/text/template/exec.go
@@ -829,16 +829,11 @@ func (s *state) evalEmptyInterface(dot reflect.Value, n parse.Node) reflect.Valu
}
// indirect returns the item at the end of indirection, and a bool to indicate if it's nil.
-// We indirect through pointers and empty interfaces (only) because
-// non-empty interfaces have methods we might need.
func indirect(v reflect.Value) (rv reflect.Value, isNil bool) {
for ; v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface; v = v.Elem() {
if v.IsNil() {
return v, true
}
- if v.Kind() == reflect.Interface && v.NumMethod() > 0 {
- break
- }
}
return v, false
}