Say i have a data structure like this:
type Foo struct {
Bar []struct {
FooBar string
}
}
And i fill it such that Bar has 3 elements. Now, using the template
library, how can i access say the 3rd element's FooBar
in that slice? I have tried the following with no success:
{Foo.Bar[2].FooBar}
{Foo.Bar.2.FooBar}
Now, i know that i can use {.repeated section Foo.Bar} {FooBar} {.end}
, but that gives me the value of foobar for each element, rather than just a specific one. I have googled and asked on irc to no avail...