|
Matt Harden |
at Jan 2, 2014 at 1:58 am
|
⇧ |
| |
At this line
https://code.google.com/p/go/source/browse/src/pkg/text/template/exec.go?name=release#462,the reflection based code take a pointer to the field even if the field
contains a pointer already. So I think it's trying to find a method Name()
on the type (**Inner) instead of just (*Inner). I'd suggest opening a bug
against the template package.
By the way, it actually works if o1 is an Outer value rather than a pointer
(*Outer). That's because it can't take a pointer to the pointer in that
case:
http://play.golang.org/p/-FgF-nTs0COn Wed, Jan 1, 2014 at 3:36 PM, decitrig wrote:I ran across this behavior while working with HTML templates; I have a
struct where one of its methods returns a special value if the receiver is
nil. This seems to be ok in templates unless the receiver is inside a
struct. Example:
http://play.golang.org/p/kI69FMyOkLI couldn't find this documented anywhere. I did find the code returning
the error; I assume it's because the template package uses reflection under
the hood?
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to
[email protected].
For more options, visit
https://groups.google.com/groups/opt_out. --
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[email protected].
For more options, visit
https://groups.google.com/groups/opt_out.