// go 1.13.6// pp is used to store a printer's state and is reused with sync.Pool to avoid allocations.typeppstruct { buf buffer...}var ppFree =sync.Pool{ New: func() interface{} { returnnew(pp) },}// newPrinter allocates a new pp struct or grabs a cached one.funcnewPrinter() *pp { p := ppFree.Get().(*pp) p.panicking =false p.erroring =false p.wrapErrs =false p.fmt.init(&p.buf)return p}// free saves used pp structs in ppFree; avoids an allocation per invocation.func (p *pp) free() {ifcap(p.buf) >64<<10 {return } p.buf = p.buf[:0] p.arg =nil p.value =reflect.Value{} p.wrappedErr =nil ppFree.Put(p)}funcFprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { p :=newPrinter() p.doPrintf(format, a) n, err = w.Write(p.buf) p.free()return}// Printf formats according to a format specifier and writes to standard output.// It returns the number of bytes written and any write error encountered.funcPrintf(format string, a ...interface{}) (n int, err error) {returnFprintf(os.Stdout, format, a...)}