Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kylelemons/godebug
Debugging helper utilities for Go
https://github.com/kylelemons/godebug
Last synced: about 1 month ago
JSON representation
Debugging helper utilities for Go
- Host: GitHub
- URL: https://github.com/kylelemons/godebug
- Owner: kylelemons
- License: apache-2.0
- Created: 2013-01-05T16:08:06.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2022-06-17T19:22:44.000Z (over 2 years ago)
- Last Synced: 2024-10-29T19:58:43.306Z (about 1 month ago)
- Language: Go
- Size: 93.8 KB
- Stars: 353
- Watchers: 6
- Forks: 38
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ccamel - kylelemons/godebug - Debugging helper utilities for Go (Go)
README
Pretty Printing for Go
======================[![godebug build status][ciimg]][ci]
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![ciimg]: https://travis-ci.org/kylelemons/godebug.svg?branch=master
[ci]: https://travis-ci.org/kylelemons/godebugQuick Examples
--------------By default, pretty will write out a very compact representation of a data structure.
From the [Print example][printex]:```
{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][diffex]. See the documentation for more examples and customization.[printex]: https://godoc.org/github.com/kylelemons/godebug/pretty#example-Print
[diffex]: https://godoc.org/github.com/kylelemons/godebug/pretty#example-CompareDocumentation
-------------Documentation for this package is available at [godoc.org][doc]:
* Pretty: [![godoc for godebug/pretty][prettyimg]][prettydoc]
* Diff: [![godoc for godebug/diff][diffimg]][diffdoc][doc]: https://godoc.org/
[prettyimg]: https://godoc.org/github.com/kylelemons/godebug/pretty?status.png
[prettydoc]: https://godoc.org/github.com/kylelemons/godebug/pretty
[diffimg]: https://godoc.org/github.com/kylelemons/godebug/diff?status.png
[diffdoc]: https://godoc.org/github.com/kylelemons/godebug/diffInstallation
------------These packages are available via `go get`:
```bash
$ go get -u github.com/kylelemons/godebug/{pretty,diff}
```Other Packages
--------------If `godebug/pretty` is not granular enough, I highly recommend
checking out [cmp][cmp] or [go-spew][spew].[cmp]: https://godoc.org/github.com/google/go-cmp/cmp
[spew]: http://godoc.org/github.com/davecgh/go-spew/spew