📌  相关文章
📜  init struct - Go 编程语言 - Go 编程语言代码示例

📅  最后修改于: 2022-03-11 14:45:01.923000             🧑  作者: Mango

代码示例2
package main

import "fmt"

func main() {
    result := Result{
        Name: "I am Groot",
        Objects: []MyStruct{
            {
                MyField: 1,
            },
            {
                MyField: 2,
            },
            {
                MyField: 3,
            },
        },
    }

    fmt.Println(result)

}

type MyStruct struct {
    MyField int
}

type Result struct {
    Name    string
    Objects []MyStruct
}