I can declare literal bar inside a function like this:
func foo() {
bar := []struct{a, b, c string} {
{ "really", "long", "row"},
{ "many", "many", "rows"},
...
}
}
But I really want it anchored (for code generation reason) outside of a function like this:
func foo() {
...
}
var bar []struct{a, b, c string} {
{ "really", "long", "row"},
{ "many", "many", "rows"},
...
}
The problem is it gets upset on the last character of the 'var bar ...' line. Is there a better way to write this?
Note for reasons outside of this discussion, I really want to avoid writing it by repeating the discrete field names:
var bar []struct{a, b, c string} {
{a: "really",b: "long",c: "row"}, // Don't want to do this
{a: "many", b: "many", c: "rows"}, // Don't want to do this
...
}
Any thoughts? What am I missing?