我开发中一直用这一段
//for debugging
func printPretty(v interface{}, mark string) (err error) {
fmt.Printf("*********%s\n", mark)
data, err := json.MarshalIndent(v, "", " ")
if err != nil {
return
}
data = append(data, ‘\n‘)
os.Stdout.Write(data)
return
}
时间: 2024-11-12 06:56:30