commit | 46b3e070c3d7eca2cd75da26d08f76e211cf7154 | [log] [tgz] |
---|---|---|
author | Keith Rarick <kr@xph.us> | Fri Dec 21 21:32:39 2012 -0800 |
committer | Keith Rarick <kr@xph.us> | Fri Dec 21 21:32:39 2012 -0800 |
tree | 61d391797451060e1a8b8d0b52cd8a78b4361d17 | |
parent | 5ce225cb821158bebffbac67614f9887c9f8012a [diff] | |
parent | 4c5f1d70177ad8ac6fd960b4ee76436fcf643a0f [diff] |
Merge pull request #4 from kortschak/master Allow formatter to avoid panic'ing on unexported fields.
Package pretty provides pretty-printing for Go values. This is useful during debugging, to avoid wrapping long output lines in the terminal.
It provides a function, Formatter, that can be used with any function that accepts a format string. For example,
type LongTypeName struct { longFieldName, otherLongFieldName int } func TestFoo(t *testing.T) { var x []LongTypeName{{1, 2}, {3, 4}, {5, 6}} t.Errorf("%# v", Formatter(x)) }
This package also provides a convenience wrapper for each function in package fmt that takes a format string.
See GoDoc for automatic documentation.
$ go get github.com/kr/pretty
then
import "github.com/kr/pretty"