golang:使用嵌套结构

I have two structs:

type person struct {
    name string
    age  int
}

type class struct {
    students []person   
}

Lets say that in the main function, I create and populate two person variables and then I want to add them to a variable with class type. How can I do it?

I.e.

 s := person{name: "Sean", age: 50}
 t := person{name: "Nicola", age: 35} 

how I can put s and t into: lab:=class ?

The following should achieve what you want:

lab := class{[]person{s, t}}

Test it here.

Before you continue working on your project it's strongly recommended you read the following: