I want to create a composite literal of arrays of arrays within a struct. Outside of a struct
package main
import "fmt"
func main() {
x := [...][]string {{"a", "b"}}
fmt.Printf("%s", x)
}
works. (http://play.golang.org/p/C2RbNnd7LL)
But I can't define a field of type [...][]string within a struct. As in http://play.golang.org/p/wHNeeuAJuO
package main
import "fmt"
type t struct {
f [...][]string
}
func main() {
x := [...][]string {{"a", "b"}}
y := t{x}
fmt.Printf("%s", y)
}
f gives the errror use of [...] array outside of array literal