Mixture of field:value and value initializers structs & slices

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)
}

Where you wrote “error here”, you are defining a single menu, but you want an array going into the Menu field of restaurant:

  restaurant := restaurants{
    restaurant{
      Name: "obama's castle",
      Menu: []menu{ // new part
        menu{ 
          Dish:  "potatos",
        Hour:  "Dinner",
        Price: 35.99,
      },
    }, // and close bracket
  },
}

so your solution is helpful and definitely put me on the right track, but I found an alternative solution:

package main

import "fmt"

type Menu struct {

    Dish, Hour string

    Price      float64

}

type Restaurant struct {

    Name string

    Menu

}

// takes type restaurants value of restaurant struct as slice, meaning I can pass multiple

type restaurants []Restaurant

func main() {

    r := restaurants{

        Restaurant{

            Name: "obama's castle",

            Menu: Menu{

                Dish:  "potatos",

                Hour:  "dinner",

                Price: 34.99,

            },

        },

        Restaurant{

            Name: "Pizza Palace",

            Menu: Menu{

                Dish:  "Pizza",

                Hour:  "dinner",

                Price: 34.99,

            },

        },

    }

    fmt.Println(r)

}

Basically I’m just wrapping my struct into a slice of structs