如何轻松漂亮地打印和突出显示结构?

I'm writing a lot of little scripts right now to learn go and for better or worse have gotten used to seeing output such as arrays, maps, slices in a nice highlighted, indented, pretty format.

I should maybe use http://golang.org/pkg/go/printer/#example_Fprint but I'm not exactly sure how to use it nor if it gives me the result I'm looking for...

ex: ruby's pry

enter image description here

If its a dumb idea for even asking for pretty printed output please explain in brief.

http://golang.org/pkg/fmt/

%v the value in a default format. when printing structs, the plus flag (%+v) adds field names

%#v a Go-syntax representation of the value

Like so:

fmt.Printf("%+v", mystruct)

Try github.com/davecgh/go-spew. It's like "%#v", but has much more prettier and detailed output.