]> Cypherpunks repositories - gostls13.git/commitdiff
bug fix
authorRobert Griesemer <gri@golang.org>
Fri, 31 Jul 2009 02:29:31 +0000 (19:29 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 31 Jul 2009 02:29:31 +0000 (19:29 -0700)
R=rsc
OCL=32563
CL=32563

src/pkg/template/template.go

index dbbadeedfd7070104fa478e1a50b024a320a9523..60021a423ef9983e1647748a4e013b079d9c6ed2 100644 (file)
@@ -569,10 +569,11 @@ func (st *state) findVar(s string) reflect.Value {
        if s == "@" {
                return st.data
        }
-       data := reflect.Indirect(st.data);
+       data := st.data;
        elems := strings.Split(s, ".", 0);
        for i := 0; i < len(elems); i++ {
                // Look up field; data must be a struct.
+               data = reflect.Indirect(data);
                typ, ok := data.Type().(*reflect.StructType);
                if !ok {
                        return nil
@@ -581,7 +582,7 @@ func (st *state) findVar(s string) reflect.Value {
                if !ok {
                        return nil
                }
-               data = reflect.Indirect(data.(*reflect.StructValue).Field(field.Index));
+               data = data.(*reflect.StructValue).Field(field.Index);
        }
        return data
 }