type Parser … // Reset initializes a parser to scan format strings for the given args. func (p *Parser) Reset(args []interface{ … } // Text returns the part of the format string that was parsed by the last call // to Scan. It returns the original substitution clause if the current scan // parsed a substitution. func (p *Parser) Text() string { … } // SetFormat sets a new format string to parse. It does not reset the argument // count. func (p *Parser) SetFormat(format string) { … } type Status … const StatusText … const StatusSubstitution … const StatusBadWidthSubstitution … const StatusBadPrecSubstitution … const StatusNoVerb … const StatusBadArgNum … const StatusMissingArg … // ClearFlags reset the parser to default behavior. func (p *Parser) ClearFlags() { … } // Scan scans the next part of the format string and sets the status to // indicate whether it scanned a string literal, substitution or error. func (p *Parser) Scan() bool { … } // intFromArg gets the ArgNumth element of Args. On return, isInt reports // whether the argument has integer type. func (p *Parser) intFromArg() (num int, isInt bool) { … } // parseArgNumber returns the value of the bracketed number, minus 1 // (explicit argument numbers are one-indexed but we want zero-indexed). // The opening bracket is known to be present at format[0]. // The returned values are the index, the number of bytes to consume // up to the closing paren, if present, and whether the number parsed // ok. The bytes to consume will be 1 if no closing paren is present. func parseArgNumber(format string) (index int, wid int, ok bool) { … } // updateArgNumber returns the next argument to evaluate, which is either the value of the passed-in // argNum or the value of the bracketed integer that begins format[i:]. It also returns // the new value of i, that is, the index of the next byte of the format to process. func (p *Parser) updateArgNumber(format string, i int) (newi int, found bool) { … } // tooLarge reports whether the magnitude of the integer is // too large to be used as a formatting width or precision. func tooLarge(x int) bool { … } // parsenum converts ASCII to integer. num is 0 (and isnum is false) if no number present. func parsenum(s string, start, end int) (num int, isnum bool, newi int) { … }