【发布时间】:2014-08-22 02:56:19
【问题描述】:
如何在 Golang 中打印(在控制台中)此结构的 Id、Title、Name 等?
type Project struct {
Id int64 `json:"project_id"`
Title string `json:"title"`
Name string `json:"name"`
Data Data `json:"data"`
Commits Commits `json:"commits"`
}
【问题讨论】:
-
全部,用于调试?试试
fmt.Println。 -
我真的很喜欢用 spew github.com/davecgh/go-spew
-
github.com/hexops/valast 是 go-spew 的最新替代品。