Documentation
¶
Index ¶
- func Append(p *InternalPrinter, b []byte)
- func Buf(p *InternalPrinter) []byte
- func DoPrint(p *InternalPrinter, a []interface{})
- func DoPrintf(p *InternalPrinter, format string, a []interface{})
- func Fprint(w io.Writer, a ...interface{}) (n int, err error)
- func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error)
- func Fprintln(w io.Writer, a ...interface{}) (n int, err error)
- func Free(p *InternalPrinter)
- func GetState(p *InternalPrinter) int
- func Print(a ...interface{}) (n int, err error)
- func PrintArg(p *InternalPrinter, a interface{}, verb rune)
- func Printf(format string, a ...interface{}) (n int, err error)
- func Println(a ...interface{}) (n int, err error)
- func SetHook(p *InternalPrinter, ...)
- func SetState(p *InternalPrinter, b []byte)
- func Sprint(a ...interface{}) string
- func Sprintf(format string, a ...interface{}) string
- func Sprintln(a ...interface{}) string
- type Formatter
- type GoStringer
- type InternalBuffer
- type InternalPrinter
- type State
- type Stringer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoPrint ¶
func DoPrint(p *InternalPrinter, a []interface{})
DoPrint exposes the doPrint() method to the redact package.
func DoPrintf ¶
func DoPrintf(p *InternalPrinter, format string, a []interface{})
DoPrintf exposes the doPrintf() method to the redact package.
func Fprint ¶
Fprint formats using the default formats for its operands and writes to w. Spaces are added between operands when neither is a string. It returns the number of bytes written and any write error encountered.
func Fprintf ¶
Fprintf formats according to a format specifier and writes to w. It returns the number of bytes written and any write error encountered.
func Fprintln ¶
Fprintln formats using the default formats for its operands and writes to w. Spaces are always added between operands and a newline is appended. It returns the number of bytes written and any write error encountered.
func GetState ¶
func GetState(p *InternalPrinter) int
GetState exposes the state to the redact package.
func Print ¶
Print formats using the default formats for its operands and writes to standard output. Spaces are added between operands when neither is a string. It returns the number of bytes written and any write error encountered.
func PrintArg ¶
func PrintArg(p *InternalPrinter, a interface{}, verb rune)
PrintArg exposes the printArgOrig() method to the redact package.
func Printf ¶
Printf formats according to a format specifier and writes to standard output. It returns the number of bytes written and any write error encountered.
func Println ¶
Println formats using the default formats for its operands and writes to standard output. Spaces are always added between operands and a newline is appended. It returns the number of bytes written and any write error encountered.
func SetHook ¶
func SetHook( p *InternalPrinter, fn func(p *InternalPrinter, arg interface{}, verb rune) (newState int), )
SetHook connects an outer printer to the inner printer.
func SetState ¶
func SetState(p *InternalPrinter, b []byte)
SetState exposes the string buffer to the redact package.
func Sprint ¶
func Sprint(a ...interface{}) string
Sprint formats using the default formats for its operands and returns the resulting string. Spaces are added between operands when neither is a string.
Types ¶
type Formatter ¶
type Formatter interface {
// CUSTOM: refer to the original type, not the one defined here.
Format(f origFmt.State, c rune)
}
Formatter is the interface implemented by values with a custom formatter. The implementation of Format may call Sprint(f) or Fprint(f) etc. to generate its output.
type GoStringer ¶
type GoStringer interface {
GoString() string
}
GoStringer is implemented by any value that has a GoString method, which defines the Go syntax for that value. The GoString method is used to print values passed as an operand to a %#v format.
type InternalBuffer ¶
type InternalBuffer = buffer
InternalBuffer exposes buffer to the redact package.
type InternalPrinter ¶
type InternalPrinter = pp
InternalPrinter exposes pp to the redact package.
func NewInternalPrinter ¶
func NewInternalPrinter() *InternalPrinter
NewInternalPrinter exposes pp allocation to the redact package.
type State ¶
type State interface {
// Write is the function to call to emit formatted output to be printed.
Write(b []byte) (n int, err error)
// Width returns the value of the width option and whether it has been set.
Width() (wid int, ok bool)
// Precision returns the value of the precision option and whether it has been set.
Precision() (prec int, ok bool)
// Flag reports whether the flag c, a character, has been set.
Flag(c int) bool
}
State represents the printer state passed to custom formatters. It provides access to the io.Writer interface plus information about the flags and options for the operand's format specifier.
type Stringer ¶
type Stringer interface {
String() string
}
Stringer is implemented by any value that has a String method, which defines the “native” format for that value. The String method is used to print values passed as an operand to any format that accepts a string or to an unformatted printer such as Print.