commit | 8090bbff86adfd6c765d54e31b5d5a804ce8382a | [log] [tgz] |
---|---|---|
author | Kyle Lemons <kyle@kylelemons.net> | Tue Aug 22 03:53:15 2017 |
committer | Kyle Lemons <kyle@kylelemons.net> | Tue Aug 22 03:53:15 2017 |
tree | 1f988c76e36ea329b5664382cac46b051e8651b2 | |
parent | f987c1853e36bf8909f185f815dd67d068276feb [diff] |
Switch from ref#1 to <#1> style representation; I think I like this better.
Have you ever wanted to get a pretty-printed version of a Go data structure, complete with indentation? I have found this especially useful in unit tests and in debugging my code, and thus godebug was born!
By default, pretty will write out a very compact representation of a data structure. From the Print example:
{Name: "Spaceship Heart of Gold", Crew: {Arthur Dent: "Along for the Ride", Ford Prefect: "A Hoopy Frood", Trillian: "Human", Zaphod Beeblebrox: "Galactic President"}, Androids: 1, Stolen: true}
It can also produce a much more verbose, one-item-per-line representation suitable for computing diffs. See the documentation for more examples and customization.
Documentation for this package is available at godoc.org:
These packages are available via go get
:
$ go get -u github.com/kylelemons/godebug/{pretty,diff}
If godebug/pretty
is not granular enough, I highly recommend checking out go-spew.