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? -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/94da4a1c-2eb9-4b28-b9b7-9b0d44b237f1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.