| commit | e201f86731084fdf262954c1325ff4e17f7b5165 | [log] [tgz] |
|---|---|---|
| author | Blake Mizerany <[email protected]> | Tue Dec 27 19:17:39 2011 |
| committer | Blake Mizerany <[email protected]> | Tue Dec 27 19:18:17 2011 |
| tree | fa6d9212e8c3a95d1f1c9d86d40fac3d0af4fbcd | |
| parent | 9c87471b7848a88fed457e1be3305b70409fcfac [diff] |
fixes for weekly.2011-12-22
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"