Documentation ¶
Overview ¶
Package printer implements auto-indenting printer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type P ¶
type P struct {
// contains filtered or unexported fields
}
func (*P) Bytes ¶
Bytes returns the bytes written by Printf. It is valid up to the next call to Printf or Reset.
func (*P) Printf ¶
Printf format-writes to p's buffer. The formatting is similar to the fmt package, and the written content can be retrieved with Bytes. Printf is line-oriented: each call should correspond to a new line in the output. Printf automatically inserts a newline at the end of each call.
Printf automatically keeps track of curly-braces and indents lines accordingly. The indentation is not "gofmt-correct" but should print code in "curly brace languages" well enough that callers don't need to keep track of indentation level. Printf ignores leading and trailing whitespaces in s; callers can use them for visual aid without interfering with automatic indentation.