// Special processing considerations. // %T (the value's type) and %p (its address) are special; we always do them first. switch verb { case'T': p.fmt.fmtS(reflect.TypeOf(arg).String()) return case'p': p.fmtPointer(reflect.ValueOf(arg), 'p') return } // Some types can be done without reflection. switch f := arg.(type) { casebool: p.fmtBool(f, verb) casefloat32: p.fmtFloat(float64(f), 32, verb) casefloat64: p.fmtFloat(f, 64, verb) casecomplex64: p.fmtComplex(complex128(f), 64, verb) casecomplex128: p.fmtComplex(f, 128, verb) caseint: p.fmtInteger(uint64(f), signed, verb) caseint8: p.fmtInteger(uint64(f), signed, verb) caseint16: p.fmtInteger(uint64(f), signed, verb) caseint32: p.fmtInteger(uint64(f), signed, verb) caseint64: p.fmtInteger(uint64(f), signed, verb) caseuint: p.fmtInteger(uint64(f), unsigned, verb) caseuint8: p.fmtInteger(uint64(f), unsigned, verb) caseuint16: p.fmtInteger(uint64(f), unsigned, verb) caseuint32: p.fmtInteger(uint64(f), unsigned, verb) caseuint64: p.fmtInteger(f, unsigned, verb) caseuintptr: p.fmtInteger(uint64(f), unsigned, verb) casestring: p.fmtString(f, verb) case []byte: p.fmtBytes(f, verb, "[]byte") case reflect.Value: // Handle extractable values with special methods // since printValue does not handle them at depth 0. if f.IsValid() && f.CanInterface() { p.arg = f.Interface() if p.handleMethods(verb) { return } } p.printValue(f, verb, 0) default: // If the type is not simple, it might have methods. if !p.handleMethods(verb) { // Need to use reflection, since the type had no // interface methods that could be used for formatting. p.printValue(reflect.ValueOf(f), verb, 0) } } }
.data.rel.ro:00000000002BCBE8 io_Writer_struct dq offset RTYPE_io_Writer .data.rel.ro:00000000002BCBF0 dq offset RTYPE__ptr_os_File .data.rel.ro:00000000002BCBF8 db 44h ; D .data.rel.ro:00000000002BCBF9 db 0B5h .data.rel.ro:00000000002BCBFA db 0F3h .data.rel.ro:00000000002BCBFB db 33h ; 3 .data.rel.ro:00000000002BCBFC db 0 .data.rel.ro:00000000002BCBFD db 0 .data.rel.ro:00000000002BCBFE db 0 .data.rel.ro:00000000002BCBFF db 0 .data.rel.ro:00000000002BCC00 dq offset os__ptr_File_Write