type Config struct {
Size struct{ w, h int }
Gravity float64
speed int
}
package main
func main() { config := game.Config{
Size: struct{ w, h int }{ w: 800, h: 600 }, // Error: Cannot use struct{ w, h int }{ w: 800, h: 600 } (type struct {...}) as type struct {...}
}}
I understand I can make "Size" an exported type in package game and that would work.
I'd like to know why can't I use struct literal for initialization; is it because the struct in (Size struct{ w, h int }) is an unnamed type and unnamed types are never exported?