how to pretty printed and highlighted structs easily?
go
Solution
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)
Problem
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 If its a dumb idea for even asking for pretty printed output please explain in brief.