我开发中一直用这一段
//for debugging
func printPretty(v interface{}, mark string) (err error) {
fmt.Printf("*********%s
", mark)
data, err := json.MarshalIndent(v, "", " ")
if err != nil {
return
}
data = append(data, '
')
os.Stdout.Write(data)
return
}