Thanks, Burak! On Tuesday, February 20, 2018 at 4:29:44 PM UTC-8, Burak Serdar wrote: > > On Tue, Feb 20, 2018 at 5:23 PM, Alex Dvoretskiy > <advore...@gmail.com <javascript:>> wrote: > > Hello golang-nuts, > > > > https://play.golang.org/p/Lib9EfWcsjG > > > > If you run this code it works fine. But if you remove one "Actor" key - > > template stops executing: "template: movielist:10:14: executing > "movielist" > > at <.Actor.Name>: can't evaluate field Name in type *main.Actor" > > > > Modified version: https://play.golang.org/p/K2DS99iZmFl > > > > `{"Movies": > > [ > > { > > "Title": "Cool Hand Luke", > > "Actor": {"Name": "Paul Newman"} > > }, > > { > > "Title": "Bullitt", > > "Actor": {"Name":"Steve McQueen"} > > }, > > { > > "Title": "Casablanca" > > } > > ] > > }` > > > > Can you advice how should I change the template to make it work? > > <td>{{if .Actor}}{{.Actor.Name}}{{end}}</td> > > > > > > Thanks > > Alex > > > > -- > > 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 golang-nuts...@googlegroups.com <javascript:>. > > For more options, visit https://groups.google.com/d/optout. >
-- 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 golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.