4
如何声明结构体数组?声明结构字面数组
转到:
type Ping struct {
Content []aContent
}
type aContent struct {
Type string
Id string
Created_at int64
}
func main() {
f := Ping{Content: []aContent{Type: "Hello", Id: "asdf"}}
fmt.Println(f)
}
的代码可以在这里找到:http://play.golang.org/p/-SyRw6dDUm
天才。谢谢!将在7分钟内接受 – user3918985 2014-09-24 08:06:31
我认为最后还有一个额外的支架,应该只有2个 – pconcepcion 2017-09-27 18:08:56