commit | e86b82e37c57ffa2c970a915ae7d768f46347228 | [log] [tgz] |
---|---|---|
author | Dave Cheney <dave@cheney.net> | Fri Apr 15 11:35:13 2011 |
committer | Dave Cheney <dave@cheney.net> | Fri Apr 15 11:35:13 2011 |
tree | c4397b6af26c487e19baec84eb9a35e9c1be34c0 | |
parent | 45b22bc2b61db92eee1def9d7a405a08c5bbf8fc [diff] |
formatter.go: gofix'd reflection changes from weekly.2011-04-13
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.
$ goinstall github.com/kr/pretty.go
then
import "github.com/kr/pretty.go"