commit | 45b22bc2b61db92eee1def9d7a405a08c5bbf8fc | [log] [tgz] |
---|---|---|
author | Keith Rarick <kr@xph.us> | Mon Jan 17 18:04:10 2011 -0800 |
committer | Keith Rarick <kr@xph.us> | Mon Jan 17 18:04:10 2011 -0800 |
tree | 7ddc0265a7448c3d1c40037a31d658e8ca4ac6c9 | |
parent | 8e507e961c0fb16f49de51c5cf9ce53eb1b3634d [diff] |
fix output for empty string
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"