Documentation ¶
Overview ¶
Pretty-print Go data structures
Index ¶
Constants ¶
View Source
const ( DEFAULT_INDENT = " " DEFAULT_NIL = "nil" )
Variables ¶
This section is empty.
Functions ¶
func PrettyFormat ¶
func PrettyFormat(i interface{}) string
pretty print the input value (to a string)
func PrettyPrintTo ¶
pretty print the input value (to specified writer)
Types ¶
type Pretty ¶
type Pretty struct { // indent string Indent string // output recipient Out io.Writer // string for nil NilString string // compact empty array and struct Compact bool // Maximum nesting level MaxLevel int }
The context for printing
func (*Pretty) Print ¶
func (p *Pretty) Print(i interface{})
pretty print the input value (no newline)
func (*Pretty) PrintValue ¶
recursively print the input value
type TabPrinter ¶
type TabPrinter struct {
// contains filtered or unexported fields
}
A TabPrinter is an object that allows printing tab-aligned words on multiple lines, up to a maximum number per line
func NewTabPrinter ¶
func NewTabPrinter(max int) *TabPrinter
create a TabPrinter
max specifies the maximum number of 'words' per line
func (*TabPrinter) Print ¶
func (tp *TabPrinter) Print(arg interface{})
print a 'word'
when the maximum number of words per lines is reached, this will print the formatted line
func (*TabPrinter) Println ¶
func (tp *TabPrinter) Println()
print current line
terminate current line and print - call this after all words have been printed
func (*TabPrinter) TabWidth ¶
func (tp *TabPrinter) TabWidth(n int)
update tab width (minimal space between words)
Click to show internal directories.
Click to hide internal directories.