fmt

Imports

Imports #

"strconv"
"unicode/utf8"
"internal/fmtsort"
"io"
"os"
"reflect"
"strconv"
"sync"
"unicode/utf8"
"errors"
"io"
"math"
"os"
"reflect"
"strconv"
"sync"
"unicode/utf8"
"errors"
"slices"

Constants & Variables

badIndexString const #

Strings for use with buffer.WriteString. This is less overhead than using buffer.Write with byte arrays.

const badIndexString = "(BADINDEX)"

badPrecString const #

Strings for use with buffer.WriteString. This is less overhead than using buffer.Write with byte arrays.

const badPrecString = "%!(BADPREC)"

badWidthString const #

Strings for use with buffer.WriteString. This is less overhead than using buffer.Write with byte arrays.

const badWidthString = "%!(BADWIDTH)"

binaryDigits const #

Numerical elements

const binaryDigits = "01"

commaSpaceString const #

Strings for use with buffer.WriteString. This is less overhead than using buffer.Write with byte arrays.

const commaSpaceString = ", "

decimalDigits const #

Numerical elements

const decimalDigits = "0123456789"

eof const #

const eof = *ast.UnaryExpr

errBool var #

var errBool = *ast.CallExpr

errComplex var #

var errComplex = *ast.CallExpr

exponent const #

Numerical elements

const exponent = "eEpP"

extraString const #

Strings for use with buffer.WriteString. This is less overhead than using buffer.Write with byte arrays.

const extraString = "%!(EXTRA "

floatVerbs const #

const floatVerbs = "beEfFgGv"

hexadecimalDigits const #

Numerical elements

const hexadecimalDigits = "0123456789aAbBcCdDeEfF"

hugeWid const #

const hugeWid = *ast.BinaryExpr

intBits const #

const intBits = *ast.BinaryExpr

invReflectString const #

Strings for use with buffer.WriteString. This is less overhead than using buffer.Write with byte arrays.

const invReflectString = ""

ldigits const #

const ldigits = "0123456789abcdefx"

mapString const #

Strings for use with buffer.WriteString. This is less overhead than using buffer.Write with byte arrays.

const mapString = "map["

missingString const #

Strings for use with buffer.WriteString. This is less overhead than using buffer.Write with byte arrays.

const missingString = "(MISSING)"

nilAngleString const #

Strings for use with buffer.WriteString. This is less overhead than using buffer.Write with byte arrays.

const nilAngleString = ""

nilParenString const #

Strings for use with buffer.WriteString. This is less overhead than using buffer.Write with byte arrays.

const nilParenString = "(nil)"

nilString const #

Strings for use with buffer.WriteString. This is less overhead than using buffer.Write with byte arrays.

const nilString = "nil"

noVerbString const #

Strings for use with buffer.WriteString. This is less overhead than using buffer.Write with byte arrays.

const noVerbString = "%!(NOVERB)"

octalDigits const #

Numerical elements

const octalDigits = "01234567"

panicString const #

Strings for use with buffer.WriteString. This is less overhead than using buffer.Write with byte arrays.

const panicString = "(PANIC="

percentBangString const #

Strings for use with buffer.WriteString. This is less overhead than using buffer.Write with byte arrays.

const percentBangString = "%!"

period const #

Numerical elements

const period = "."

ppFree var #

var ppFree = sync.Pool{...}

sign const #

Numerical elements

const sign = "+-"

signed const #

const signed = true

space var #

space is a copy of the unicode.White_Space ranges, to avoid depending on package unicode.

var space = [][2]uint16{...}

ssFree var #

var ssFree = sync.Pool{...}

udigits const #

const udigits = "0123456789ABCDEFX"

uintptrBits const #

const uintptrBits = *ast.BinaryExpr

unsigned const #

const unsigned = false

Type Aliases

buffer type #

Use simple []byte instead of bytes.Buffer to avoid large dependency.

type buffer []byte

stringReader type #

type stringReader string

Interfaces

Formatter interface #

Formatter is implemented by any value that has a Format method. The implementation controls how [State] and rune are interpreted, and may call [Sprint] or [Fprint](f) etc. to generate its output.

type Formatter interface {
Format(f State, verb rune)
}

GoStringer interface #

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 GoStringer interface {
GoString() string
}

ScanState interface #

ScanState represents the scanner state passed to custom scanners. Scanners may do rune-at-a-time scanning or ask the ScanState to discover the next space-delimited token.

type ScanState interface {
ReadRune() (r rune, size int, err error)
UnreadRune() error
SkipSpace()
Token(skipSpace bool, f func(rune) bool) (token []byte, err error)
Width() (wid int, ok bool)
Read(buf []byte) (n int, err error)
}

Scanner interface #

Scanner is implemented by any value that has a Scan method, which scans the input for the representation of a value and stores the result in the receiver, which must be a pointer to be useful. The Scan method is called for any argument to [Scan], [Scanf], or [Scanln] that implements it.

type Scanner interface {
Scan(state ScanState, verb rune) error
}

State interface #

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 State interface {
Write(b []byte) (n int, err error)
Width() (wid int, ok bool)
Precision() (prec int, ok bool)
Flag(c int) bool
}

Stringer interface #

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].

type Stringer interface {
String() string
}

Structs

fmt struct #

A fmt is the raw formatter used by Printf etc. It prints into a buffer that must be set up separately.

type fmt struct {
buf *buffer
fmtFlags
wid int
prec int
intbuf [68]byte
}

fmtFlags struct #

flags placed in a separate struct for easy clearing.

type fmtFlags struct {
widPresent bool
precPresent bool
minus bool
plus bool
sharp bool
space bool
zero bool
plusV bool
sharpV bool
}

pp struct #

pp is used to store a printer's state and is reused with sync.Pool to avoid allocations.

type pp struct {
buf buffer
arg any
value reflect.Value
fmt fmt
reordered bool
goodArgNum bool
panicking bool
erroring bool
wrapErrs bool
wrappedErrs []int
}

readRune struct #

readRune is a structure to enable reading UTF-8 encoded code points from an io.Reader. It is used if the Reader given to the scanner does not already implement io.RuneScanner.

type readRune struct {
reader io.Reader
buf [utf8.UTFMax]byte
pending int
pendBuf [utf8.UTFMax]byte
peekRune rune
}

scanError struct #

scanError represents an error generated by the scanning software. It's used as a unique signature to identify such errors when recovering.

type scanError struct {
err error
}

ss struct #

ss is the internal implementation of ScanState.

type ss struct {
rs io.RuneScanner
buf buffer
count int
atEOF bool
ssave
}

ssave struct #

ssave holds the parts of ss that need to be saved and restored on recursive scans.

type ssave struct {
validSave bool
nlIsEnd bool
nlIsSpace bool
argLimit int
limit int
maxWid int
}

wrapError struct #

type wrapError struct {
msg string
err error
}

wrapErrors struct #

type wrapErrors struct {
msg string
errs []error
}

Functions

Append function #

Append formats using the default formats for its operands, appends the result to the byte slice, and returns the updated slice.

func Append(b []byte, a ...any) []byte

Appendf function #

Appendf formats according to a format specifier, appends the result to the byte slice, and returns the updated slice.

func Appendf(b []byte, format string, a ...any) []byte

Appendln function #

Appendln formats using the default formats for its operands, appends the result to the byte slice, and returns the updated slice. Spaces are always added between operands and a newline is appended.

func Appendln(b []byte, a ...any) []byte

Error method #

func (e *wrapErrors) Error() string

Error method #

func (e *wrapError) Error() string

Errorf function #

Errorf formats according to a format specifier and returns the string as a value that satisfies error. If the format specifier includes a %w verb with an error operand, the returned error will implement an Unwrap method returning the operand. If there is more than one %w verb, the returned error will implement an Unwrap method returning a []error containing all the %w operands in the order they appear in the arguments. It is invalid to supply the %w verb with an operand that does not implement the error interface. The %w verb is otherwise a synonym for %v.

func Errorf(format string, a ...any) error

Flag method #

func (p *pp) Flag(b int) bool

FormatString function #

FormatString returns a string representing the fully qualified formatting directive captured by the [State], followed by the argument verb. ([State] does not itself contain the verb.) The result has a leading percent sign followed by any flags, the width, and the precision. Missing flags, width, and precision are omitted. This function allows a [Formatter] to reconstruct the original directive triggering the call to Format.

func FormatString(state State, verb rune) string

Fprint function #

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 Fprint(w io.Writer, a ...any) (n int, err error)

Fprintf function #

Fprintf formats according to a format specifier and writes to w. It returns the number of bytes written and any write error encountered.

func Fprintf(w io.Writer, format string, a ...any) (n int, err error)

Fprintln function #

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 Fprintln(w io.Writer, a ...any) (n int, err error)

Fscan function #

Fscan scans text read from r, storing successive space-separated values into successive arguments. Newlines count as space. It returns the number of items successfully scanned. If that is less than the number of arguments, err will report why.

func Fscan(r io.Reader, a ...any) (n int, err error)

Fscanf function #

Fscanf scans text read from r, storing successive space-separated values into successive arguments as determined by the format. It returns the number of items successfully parsed. Newlines in the input must match newlines in the format.

func Fscanf(r io.Reader, format string, a ...any) (n int, err error)

Fscanln function #

Fscanln is similar to [Fscan], but stops scanning at a newline and after the final item there must be a newline or EOF.

func Fscanln(r io.Reader, a ...any) (n int, err error)

Precision method #

func (p *pp) Precision() (prec int, ok bool)

Print function #

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 Print(a ...any) (n int, err error)

Printf function #

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 Printf(format string, a ...any) (n int, err error)

Println function #

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 Println(a ...any) (n int, err error)

Read method #

The Read method is only in ScanState so that ScanState satisfies io.Reader. It will never be called when used as intended, so there is no need to make it actually work.

func (s *ss) Read(buf []byte) (n int, err error)

Read method #

func (r *stringReader) Read(b []byte) (n int, err error)

ReadRune method #

func (s *ss) ReadRune() (r rune, size int, err error)

ReadRune method #

ReadRune returns the next UTF-8 encoded code point from the io.Reader inside r.

func (r *readRune) ReadRune() (rr rune, size int, err error)

Scan function #

Scan scans text read from standard input, storing successive space-separated values into successive arguments. Newlines count as space. It returns the number of items successfully scanned. If that is less than the number of arguments, err will report why.

func Scan(a ...any) (n int, err error)

Scanf function #

Scanf scans text read from standard input, storing successive space-separated values into successive arguments as determined by the format. It returns the number of items successfully scanned. If that is less than the number of arguments, err will report why. Newlines in the input must match newlines in the format. The one exception: the verb %c always scans the next rune in the input, even if it is a space (or tab etc.) or newline.

func Scanf(format string, a ...any) (n int, err error)

Scanln function #

Scanln is similar to [Scan], but stops scanning at a newline and after the final item there must be a newline or EOF.

func Scanln(a ...any) (n int, err error)

SkipSpace method #

SkipSpace provides Scan methods the ability to skip space and newline characters in keeping with the current scanning mode set by format strings and [Scan]/[Scanln].

func (s *ss) SkipSpace()

Sprint function #

Sprint formats using the default formats for its operands and returns the resulting string. Spaces are added between operands when neither is a string.

func Sprint(a ...any) string

Sprintf function #

Sprintf formats according to a format specifier and returns the resulting string.

func Sprintf(format string, a ...any) string

Sprintln function #

Sprintln formats using the default formats for its operands and returns the resulting string. Spaces are always added between operands and a newline is appended.

func Sprintln(a ...any) string

Sscan function #

Sscan scans the argument string, storing successive space-separated values into successive arguments. Newlines count as space. It returns the number of items successfully scanned. If that is less than the number of arguments, err will report why.

func Sscan(str string, a ...any) (n int, err error)

Sscanf function #

Sscanf scans the argument string, storing successive space-separated values into successive arguments as determined by the format. It returns the number of items successfully parsed. Newlines in the input must match newlines in the format.

func Sscanf(str string, format string, a ...any) (n int, err error)

Sscanln function #

Sscanln is similar to [Sscan], but stops scanning at a newline and after the final item there must be a newline or EOF.

func Sscanln(str string, a ...any) (n int, err error)

Token method #

func (s *ss) Token(skipSpace bool, f func(rune) bool) (tok []byte, err error)

UnreadRune method #

func (s *ss) UnreadRune() error

UnreadRune method #

func (r *readRune) UnreadRune() error

Unwrap method #

func (e *wrapErrors) Unwrap() []error

Unwrap method #

func (e *wrapError) Unwrap() error

Width method #

func (s *ss) Width() (wid int, ok bool)

Width method #

func (p *pp) Width() (wid int, ok bool)

Write method #

Write implements [io.Writer] so we can call [Fprintf] on a pp (through [State]), for recursive use in custom verbs.

func (p *pp) Write(b []byte) (ret int, err error)

WriteString method #

WriteString implements [io.StringWriter] so that we can call [io.WriteString] on a pp (through state), for efficiency.

func (p *pp) WriteString(s string) (ret int, err error)

accept method #

accept checks the next rune in the input. If it's a byte (sic) in the string, it puts it in the buffer and returns true. Otherwise it return false.

func (s *ss) accept(ok string) bool

advance method #

advance determines whether the next characters in the input match those of the format. It returns the number of bytes (sic) consumed in the format. All runs of space characters in either input or format behave as a single space. Newlines are special, though: newlines in the format must match those in the input and vice versa. This routine also handles the %% case. If the return value is zero, either format starts with a % (with no following %) or the input is empty. If it is negative, the input did not match the string.

func (s *ss) advance(format string) (i int)

argNumber method #

argNumber 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 *pp) argNumber(argNum int, format string, i int, numArgs int) (newArgNum int, newi int, found bool)

badArgNum method #

func (p *pp) badArgNum(verb rune)

badVerb method #

func (p *pp) badVerb(verb rune)

catchPanic method #

func (p *pp) catchPanic(arg any, verb rune, method string)

clearflags method #

func (f *fmt) clearflags()

complexTokens method #

complexTokens returns the real and imaginary parts of the complex number starting here. The number might be parenthesized and has the format (N+Ni) where N is a floating-point number and there are no spaces within.

func (s *ss) complexTokens() (real string, imag string)

consume method #

consume reads the next rune in the input and reports whether it is in the ok string. If accept is true, it puts the character into the input token.

func (s *ss) consume(ok string, accept bool) bool

convertFloat method #

convertFloat converts the string to a float64value.

func (s *ss) convertFloat(str string, n int) float64

convertString method #

convertString returns the string represented by the next input characters. The format of the input is determined by the verb.

func (s *ss) convertString(verb rune) (str string)

doPrint method #

func (p *pp) doPrint(a []any)

doPrintf method #

func (p *pp) doPrintf(format string, a []any)

doPrintln method #

doPrintln is like doPrint but always adds a space between arguments and a newline after the last argument.

func (p *pp) doPrintln(a []any)

doScan method #

doScan does the real work for scanning without a format string.

func (s *ss) doScan(a []any) (numProcessed int, err error)

doScanf method #

doScanf does the real work when scanning with a format string. At the moment, it handles only pointers to basic types.

func (s *ss) doScanf(format string, a []any) (numProcessed int, err error)

error method #

func (s *ss) error(err error)

errorHandler function #

errorHandler turns local panics into error returns.

func errorHandler(errp *error)

errorString method #

func (s *ss) errorString(err string)

floatToken method #

floatToken returns the floating-point number starting here, no longer than swid if the width is specified. It's not rigorous about syntax because it doesn't check that we have at least some digits, but Atof will do that.

func (s *ss) floatToken() string

fmt0x64 method #

fmt0x64 formats a uint64 in hexadecimal and prefixes it with 0x or not, as requested, by temporarily setting the sharp flag.

func (p *pp) fmt0x64(v uint64, leading0x bool)

fmtBool method #

func (p *pp) fmtBool(v bool, verb rune)

fmtBoolean method #

fmtBoolean formats a boolean.

func (f *fmt) fmtBoolean(v bool)

fmtBs method #

fmtBs formats the byte slice b as if it was formatted as string with fmtS.

func (f *fmt) fmtBs(b []byte)

fmtBx method #

fmtBx formats a byte slice as a hexadecimal encoding of its bytes.

func (f *fmt) fmtBx(b []byte, digits string)

fmtBytes method #

func (p *pp) fmtBytes(v []byte, verb rune, typeString string)

fmtC method #

fmtC formats an integer as a Unicode character. If the character is not valid Unicode, it will print '\ufffd'.

func (f *fmt) fmtC(c uint64)

fmtComplex method #

fmtComplex formats a complex number v with r = real(v) and j = imag(v) as (r+ji) using fmtFloat for r and j formatting.

func (p *pp) fmtComplex(v complex128, size int, verb rune)

fmtFloat method #

fmtFloat formats a float64. It assumes that verb is a valid format specifier for strconv.AppendFloat and therefore fits into a byte.

func (f *fmt) fmtFloat(v float64, size int, verb rune, prec int)

fmtFloat method #

fmtFloat formats a float. The default precision for each verb is specified as last argument in the call to fmt_float.

func (p *pp) fmtFloat(v float64, size int, verb rune)

fmtInteger method #

fmtInteger formats signed and unsigned integers.

func (f *fmt) fmtInteger(u uint64, base int, isSigned bool, verb rune, digits string)

fmtInteger method #

fmtInteger formats a signed or unsigned integer.

func (p *pp) fmtInteger(v uint64, isSigned bool, verb rune)

fmtPointer method #

func (p *pp) fmtPointer(value reflect.Value, verb rune)

fmtQ method #

fmtQ formats a string as a double-quoted, escaped Go string constant. If f.sharp is set a raw (backquoted) string may be returned instead if the string does not contain any control characters other than tab.

func (f *fmt) fmtQ(s string)

fmtQc method #

fmtQc formats an integer as a single-quoted, escaped Go character constant. If the character is not valid Unicode, it will print '\ufffd'.

func (f *fmt) fmtQc(c uint64)

fmtS method #

fmtS formats a string.

func (f *fmt) fmtS(s string)

fmtSbx method #

fmtSbx formats a string or byte slice as a hexadecimal encoding of its bytes.

func (f *fmt) fmtSbx(s string, b []byte, digits string)

fmtString method #

func (p *pp) fmtString(v string, verb rune)

fmtSx method #

fmtSx formats a string as a hexadecimal encoding of its bytes.

func (f *fmt) fmtSx(s string, digits string)

fmtUnicode method #

fmtUnicode formats a uint64 as "U+0078" or with f.sharp set as "U+0078 'x'".

func (f *fmt) fmtUnicode(u uint64)

free method #

free saves used pp structs in ppFree; avoids an allocation per invocation.

func (p *pp) free()

free method #

free saves used ss structs in ssFree; avoid an allocation per invocation.

func (s *ss) free(old ssave)

getBase method #

getBase returns the numeric base represented by the verb and its digit string.

func (s *ss) getBase(verb rune) (base int, digits string)

getField function #

getField gets the i'th field of the struct value. If the field itself is a non-nil interface, return a value for the thing inside the interface, not the interface itself.

func getField(v reflect.Value, i int) reflect.Value

getRune method #

The public method returns an error; this private one panics. If getRune reaches EOF, the return value is EOF (-1).

func (s *ss) getRune() (r rune)

handleMethods method #

func (p *pp) handleMethods(verb rune) (handled bool)

hasX function #

func hasX(s string) bool

hexByte method #

hexByte returns the next hex-encoded (two-character) byte from the input. It returns ok==false if the next bytes in the input do not encode a hex byte. If the first byte is hex and the second is not, processing stops.

func (s *ss) hexByte() (b byte, ok bool)

hexDigit function #

hexDigit returns the value of the hexadecimal digit.

func hexDigit(d rune) (int, bool)

hexString method #

hexString returns the space-delimited hexpair-encoded string.

func (s *ss) hexString() string

indexRune function #

func indexRune(s string, r rune) int

init method #

func (f *fmt) init(buf *buffer)

intFromArg function #

intFromArg gets the argNumth element of a. On return, isInt reports whether the argument has integer type.

func intFromArg(a []any, argNum int) (num int, isInt bool, newArgNum int)

isSpace function #

func isSpace(r rune) bool

missingArg method #

func (p *pp) missingArg(verb rune)

mustReadRune method #

mustReadRune turns io.EOF into a panic(io.ErrUnexpectedEOF). It is called in cases such as string scanning where an EOF is a syntax error.

func (s *ss) mustReadRune() (r rune)

newPrinter function #

newPrinter allocates a new pp struct or grabs a cached one.

func newPrinter() *pp

newScanState function #

newScanState allocates a new ss struct or grab a cached one.

func newScanState(r io.Reader, nlIsSpace bool, nlIsEnd bool) (s *ss, old ssave)

notEOF method #

func (s *ss) notEOF()

notSpace function #

notSpace is the default scanning function used in Token.

func notSpace(r rune) bool

okVerb method #

okVerb verifies that the verb is present in the list, setting s.err appropriately if not.

func (s *ss) okVerb(verb rune, okVerbs string, typ string) bool

pad method #

pad appends b to f.buf, padded on left (!f.minus) or right (f.minus).

func (f *fmt) pad(b []byte)

padString method #

padString appends s to f.buf, padded on left (!f.minus) or right (f.minus).

func (f *fmt) padString(s string)

parseArgNumber function #

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)

parsenum function #

parsenum converts ASCII to integer. num is 0 (and isnum is false) if no number present.

func parsenum(s string, start int, end int) (num int, isnum bool, newi int)

peek method #

peek reports whether the next character is in the ok string, without consuming it.

func (s *ss) peek(ok string) bool

printArg method #

func (p *pp) printArg(arg any, verb rune)

printValue method #

printValue is similar to printArg but starts with a reflect value, not an interface{} value. It does not handle 'p' and 'T' verbs because these should have been already handled by printArg.

func (p *pp) printValue(value reflect.Value, verb rune, depth int)

quotedString method #

quotedString returns the double- or back-quoted string represented by the next input characters.

func (s *ss) quotedString() string

readByte method #

readByte returns the next byte from the input, which may be left over from a previous read if the UTF-8 was ill-formed.

func (r *readRune) readByte() (b byte, err error)

scanBasePrefix method #

scanBasePrefix reports whether the integer begins with a base prefix and returns the base, digit string, and whether a zero was found. It is called only if the verb is %v.

func (s *ss) scanBasePrefix() (base int, digits string, zeroFound bool)

scanBool method #

scanBool returns the value of the boolean represented by the next token.

func (s *ss) scanBool(verb rune) bool

scanComplex method #

scanComplex converts the next token to a complex128 value. The atof argument is a type-specific reader for the underlying type. If we're reading complex64, atof will parse float32s and convert them to float64's to avoid reproducing this code for each complex type.

func (s *ss) scanComplex(verb rune, n int) complex128

scanInt method #

scanInt returns the value of the integer represented by the next token, checking for overflow. Any error is stored in s.err.

func (s *ss) scanInt(verb rune, bitSize int) int64

scanNumber method #

scanNumber returns the numerical string with specified digits starting here.

func (s *ss) scanNumber(digits string, haveDigits bool) string

scanOne method #

scanOne scans a single value, deriving the scanner from the type of the argument.

func (s *ss) scanOne(verb rune, arg any)

scanPercent method #

scanPercent scans a literal percent character.

func (s *ss) scanPercent()

scanRune method #

scanRune returns the next rune value in the input.

func (s *ss) scanRune(bitSize int) int64

scanUint method #

scanUint returns the value of the unsigned integer represented by the next token, checking for overflow. Any error is stored in s.err.

func (s *ss) scanUint(verb rune, bitSize int) uint64

token method #

token returns the next space-delimited string from the input. It skips white space. For Scanln, it stops at newlines. For Scan, newlines are treated as spaces.

func (s *ss) token(skipSpace bool, f func(rune) bool) []byte

tooLarge function #

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

truncate method #

truncate truncates the byte slice b as a string of the specified precision, if present.

func (f *fmt) truncate(b []byte) []byte

truncateString method #

truncateString truncates the string s to the specified precision, if present.

func (f *fmt) truncateString(s string) string

unknownType method #

func (p *pp) unknownType(v reflect.Value)

write method #

func (b *buffer) write(p []byte)

writeByte method #

func (b *buffer) writeByte(c byte)

writePadding method #

writePadding generates n bytes of padding.

func (f *fmt) writePadding(n int)

writeRune method #

func (b *buffer) writeRune(r rune)

writeString method #

func (b *buffer) writeString(s string)

Generated with Arrow