error: mixture of field:value and value initializers
I’m not sure what I’m doing wrong I obviously need more practice, I’m basically creating menu and restaurant structs and passing them into a restaurant slice so I can create multiple instances of menus and restaurants but I am getting the mixture of field:value errors, is there a better way to do this, am I doing this completely wrong, I figure since I am passing in restaurant a name, and a slice of menus inheriting from menu, I could do that when I’m creating my restaurant, but I’m struggling with finding a solution to this. the error comes from inside restaurant in the menu, I added a picture after the code below, it’s on line 21, the side by side comparison is what I’m refactoring. My code is on the left, I don’t even know if it’s something you can do, the code on the right is what I’m trying to refactor
package main
import "fmt"
type menu struct {
Dish, Hour string
Price float64
}
type restaurant struct {
Name string
Menu []menu
}
type restaurants []restaurant
func main() {
restaurant := restaurants{
restaurant{
Name: "obama's castle",
menu{ <-- error here
Dish: "potatos",
Hour: "Dinner",
Price: 35.99,
},
},
}
fmt.Println(restaurant)
}